From 03c49dc937e6b09d067f0b46e8ee1304815e7de1 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 29 Dec 2022 12:59:45 +0100 Subject: [PATCH] Fixes #243 --- web/cm_plugins/editor_paste.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/cm_plugins/editor_paste.ts b/web/cm_plugins/editor_paste.ts index 0bd15fd9..eeffed57 100644 --- a/web/cm_plugins/editor_paste.ts +++ b/web/cm_plugins/editor_paste.ts @@ -180,9 +180,11 @@ export function attachmentExtension(editor: Editor) { return; } await editor.space.writeAttachment(finalFileName, "arraybuffer", data!); - let attachmentMarkdown = `[${finalFileName}](${finalFileName})`; + let attachmentMarkdown = `[${finalFileName}](${ + encodeURIComponent(finalFileName) + })`; if (mimeType.startsWith("image/")) { - attachmentMarkdown = `![](${finalFileName})`; + attachmentMarkdown = `![](${encodeURIComponent(finalFileName)})`; } editor.editorView!.dispatch({ changes: [