diff --git a/web/src/helpers/utils.ts b/web/src/helpers/utils.ts
index bbc314ee..90dfc57e 100644
--- a/web/src/helpers/utils.ts
+++ b/web/src/helpers/utils.ts
@@ -134,3 +134,9 @@ export const parseHTMLToRawText = (htmlStr: string): string => {
const text = tempEl.innerText;
return text;
};
+
+export function absolutifyLink(rel: string): string {
+ const anchor = document.createElement("a");
+ anchor.setAttribute("href", rel);
+ return anchor.href;
+}
diff --git a/web/src/labs/marked/parser/Image.ts b/web/src/labs/marked/parser/Image.ts
index 3432e5e2..c8d2de35 100644
--- a/web/src/labs/marked/parser/Image.ts
+++ b/web/src/labs/marked/parser/Image.ts
@@ -1,4 +1,5 @@
import { escape } from "lodash-es";
+import { absolutifyLink } from "../../../helpers/utils";
export const IMAGE_REG = /!\[.*?\]\((.+?)\)/;
@@ -8,8 +9,9 @@ const renderer = (rawStr: string): string => {
return rawStr;
}
+ const imageUrl = absolutifyLink(escape(matchResult[1]));
// NOTE: Get image blob from backend to avoid CORS.
- return `
`;
+ return `
`;
};
export default {