From 00d2b70670ab8bd0cab3e3896bbf38d8bbdb6d03 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 5 Feb 2022 23:52:55 -0600 Subject: [PATCH] uploads: fix back button behavior when not using bookmarklet. Better fix for 8173c73aa. When not using the bookmarklet, make the back button on the upload tagging page take you back to the new upload page. When using the bookmarklet, make it take you back to the source. --- .../file_upload_component/file_upload_component.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/file_upload_component/file_upload_component.js b/app/components/file_upload_component/file_upload_component.js index 0a83aeccb..60ecd6f26 100644 --- a/app/components/file_upload_component/file_upload_component.js +++ b/app/components/file_upload_component/file_upload_component.js @@ -103,13 +103,18 @@ export default class FileUploadComponent { if (upload.status === "completed") { let params = new URLSearchParams(window.location.search); + let isBookmarklet = params.has("url"); params.delete("url"); params.delete("ref"); let url = new URL(`/uploads/${upload.id}`, window.location.origin); url.search = params.toString(); - window.location.replace(url); + if (isBookmarklet) { + window.location.replace(url); + } else { + window.location.assign(url); + } } else { this.$dropzone.removeClass("success"); this.$component.find("progress").addClass("hidden");