Skip to content

Commit 513951b

Browse files
authored
Remove appSubUrl from pasted images (#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 <[email protected]>
1 parent d168f04 commit 513951b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

web_src/js/features/comp/ImagePaste.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {appSubUrl, csrfToken} = window.config;
1+
const {csrfToken} = window.config;
22

33
async function uploadFile(file, uploadUrl) {
44
const formData = new FormData();
@@ -67,7 +67,7 @@ export function initCompImagePaste($target) {
6767
const name = img.name.substr(0, img.name.lastIndexOf('.'));
6868
insertAtCursor(textarea, `![${name}]()`);
6969
const data = await uploadFile(img, uploadUrl);
70-
replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](${appSubUrl}/attachments/${data.uuid})`);
70+
replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](/attachments/${data.uuid})`);
7171
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
7272
dropzoneFiles.appendChild(input[0]);
7373
}
@@ -83,7 +83,7 @@ export function initSimpleMDEImagePaste(simplemde, dropzone, files) {
8383
const name = img.name.substr(0, img.name.lastIndexOf('.'));
8484
const data = await uploadFile(img, uploadUrl);
8585
const pos = simplemde.codemirror.getCursor();
86-
simplemde.codemirror.replaceRange(`![${name}](${appSubUrl}/attachments/${data.uuid})`, pos);
86+
simplemde.codemirror.replaceRange(`![${name}](/attachments/${data.uuid})`, pos);
8787
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
8888
files.append(input);
8989
}

0 commit comments

Comments
 (0)