From 696a49cfb27d8d0e79783b3bc949b262cebc93fb Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sat, 6 Nov 2021 18:04:57 +0000 Subject: [PATCH 1/2] Remove appsuburl from pasted images Since we fixed the url base for the links in repositories we no longer need to add the appsuburl to pasted image links. Fix #17057 Signed-off-by: Andrew Thornton --- web_src/js/features/comp/ImagePaste.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/comp/ImagePaste.js b/web_src/js/features/comp/ImagePaste.js index 30c5820f62f99..35c6eee39aec1 100644 --- a/web_src/js/features/comp/ImagePaste.js +++ b/web_src/js/features/comp/ImagePaste.js @@ -67,7 +67,7 @@ export function initCompImagePaste($target) { const name = img.name.substr(0, img.name.lastIndexOf('.')); insertAtCursor(textarea, `![${name}]()`); const data = await uploadFile(img, uploadUrl); - replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](${appSubUrl}/attachments/${data.uuid})`); + replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](/attachments/${data.uuid})`); const input = $(``).val(data.uuid); dropzoneFiles.appendChild(input[0]); } @@ -83,7 +83,7 @@ export function initSimpleMDEImagePaste(simplemde, dropzone, files) { const name = img.name.substr(0, img.name.lastIndexOf('.')); const data = await uploadFile(img, uploadUrl); const pos = simplemde.codemirror.getCursor(); - simplemde.codemirror.replaceRange(`![${name}](${appSubUrl}/attachments/${data.uuid})`, pos); + simplemde.codemirror.replaceRange(`![${name}](/attachments/${data.uuid})`, pos); const input = $(``).val(data.uuid); files.append(input); } From 06e6341af804b8a053136c315b5536397f92c116 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sun, 7 Nov 2021 09:39:07 +0000 Subject: [PATCH 2/2] placate linter Signed-off-by: Andrew Thornton --- web_src/js/features/comp/ImagePaste.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/comp/ImagePaste.js b/web_src/js/features/comp/ImagePaste.js index 35c6eee39aec1..f7f076bf80546 100644 --- a/web_src/js/features/comp/ImagePaste.js +++ b/web_src/js/features/comp/ImagePaste.js @@ -1,4 +1,4 @@ -const {appSubUrl, csrfToken} = window.config; +const {csrfToken} = window.config; async function uploadFile(file, uploadUrl) { const formData = new FormData();