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.
This commit is contained in:
evazion
2022-02-05 23:52:55 -06:00
parent d0f3e5526d
commit 00d2b70670

View File

@@ -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");