diff options
author | zeripath <art27@cantab.net> | 2021-11-08 06:27:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-08 14:27:40 +0800 |
commit | 513951bc16f31c4a2821319baea846735f341a0e (patch) | |
tree | 9847c29ff06e57b3b19b8e5013e018006378e087 /web_src/js | |
parent | d168f0498bfff3b251924804b6deafc267c5df65 (diff) | |
download | gitea-513951bc16f31c4a2821319baea846735f341a0e.tar.gz gitea-513951bc16f31c4a2821319baea846735f341a0e.zip |
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 <art27@cantab.net>
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/features/comp/ImagePaste.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/web_src/js/features/comp/ImagePaste.js b/web_src/js/features/comp/ImagePaste.js index 30c5820f62..f7f076bf80 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(); @@ -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 = $(`<input id="${data.uuid}" name="files" type="hidden">`).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 = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid); files.append(input); } |