Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Skip absolute image URLs for getImage in Markdown.svelte
Sebastian Martinez committed 3 years ago
commit 71c47a2046468165a06643b0eebcdd592d852156
parent a16814d9c3e162d6b83ec570407756368761cb6b
1 file changed +3 -2
modified src/Markdown.svelte
@@ -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);