Skip to content

armgit / memos

Public Imported from GitHub
0

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.

feat: shorten image url length

boojack3fc74490de1a
diff --git a/web/src/components/Editor/Editor.tsx b/web/src/components/Editor/Editor.tsx
index fe45188f2..c60d6f71d 100644
--- a/web/src/components/Editor/Editor.tsx
+++ b/web/src/components/Editor/Editor.tsx
@@ -73,8 +73,8 @@ const Editor = forwardRef((props: Props, ref: React.ForwardedRef<EditorRefAction
return;
}
- const resource = await resourceService.upload(file);
- const url = `https://memos.justsven.top/r/${resource.id}/${resource.filename}`;
+ const image = await resourceService.upload(file);
+ const url = `/r/${image.id}/${image.filename}`;
const prevValue = editorRef.current.value;
editorRef.current.value =
diff --git a/web/src/helpers/consts.ts b/web/src/helpers/consts.ts
index 55d1047da..d83735c9f 100644
--- a/web/src/helpers/consts.ts
+++ b/web/src/helpers/consts.ts
@@ -17,7 +17,7 @@ export const TAG_REG = /#\s(.+?)\s/g;
export const LINK_REG = /(https?:\/\/[^\s<\\*>']+)/g;
// 图片 正则
-export const IMAGE_URL_REG = /(https?:\/\/[^\s<\\*>']+\.(jpeg|jpg|gif|png|svg))/g;
+export const IMAGE_URL_REG = /([^\s<\\*>']+\.(jpeg|jpg|gif|png|svg))/g;
// memo 关联正则
export const MEMO_LINK_REG = /\[@(.+?)\]\((.+?)\)/g;