Add a step to the normalizeImgPath func. in AvatarView to check if it's a file uri.

If it is, we convert it into a link that can be used to display images.
This commit is contained in:
ricardo 2025-08-31 10:49:45 -06:00
parent 53a4f03995
commit 08c7b88a25

View file

@ -4,6 +4,7 @@
MarkdownPostProcessorContext,
MarkdownRenderer,
MarkdownView,
Platform,
TFile,
} from "obsidian";
import Fab from "./Fab.svelte";
@ -111,6 +112,10 @@
}
function normalizeImgPath(src: string): string {
// Check if the path is an external local file
if (src.startsWith("file://")) {
return src.replace("file://", Platform.resourcePathPrefix);
}
const file = app.vault.getAbstractFileByPath(src);
if (file && file instanceof TFile) {
return app.vault.getResourcePath(file);