Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix: image url host missing (#623)
boojackb04e001db1ac
diff --git a/web/src/helpers/utils.ts b/web/src/helpers/utils.tsindex bbc314eed..90dfc57ea 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.tsindex 3432e5e26..c8d2de353 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 `<img class='img' src='/o/get/image?url=${escape(matchResult[1])}' />`;+ return `<img class='img' src='/o/get/image?url=${imageUrl}' />`;};export default {