]> source.dussan.org Git - gitea.git/commitdiff
Remove appSubUrl from pasted images (#17572) (#17588)
authorzeripath <art27@cantab.net>
Mon, 8 Nov 2021 20:28:10 +0000 (20:28 +0000)
committerGitHub <noreply@github.com>
Mon, 8 Nov 2021 20:28:10 +0000 (20:28 +0000)
Backport #17572

* 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 <art27@cantab.net>
web_src/js/index.js

index aa684b0467cca62045549942c75a9e1a52a0b053..97653c03667671e3e4f72b553ebbdca2aecf7116 100644 (file)
@@ -362,7 +362,7 @@ function initImagePaste(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 = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
           dropzoneFiles.appendChild(input[0]);
         }
@@ -378,7 +378,7 @@ 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 = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
       files.append(input);
     }