Skip absolute image URLs for getImage in Markdown.svelte

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2022-08-24 11:38:12 +02:00
committed by Alexis Sellier
parent a16814d9c3
commit 71c47a2046
+3 -2
View File
@@ -3,7 +3,7 @@
import { marked } from "marked";
import matter from "@radicle/gray-matter";
import type * as proj from "@app/project";
import { getImageMime } from "@app/utils";
import { getImageMime, isUrl } from "@app/utils";
import xss, { getDefaultWhiteList } from "xss";
export let content: string;
@@ -42,7 +42,8 @@
for (let i of container.querySelectorAll("img")) {
const path = i.getAttribute("src");
if (path) {
// Make sure the source isn't a URL before trying to fetch it from the repo
if (path && !isUrl(path)) {
getImage(path).then(blob => {
if (blob.content) {
const mime = getImageMime(path);