From a061ed7408edf2ac69f0045a72a24e7e95f5b31a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 11 Oct 2023 18:44:05 -0400 Subject: [PATCH] Don't try to destroy the upload window if it doesn't exist. --- webcit-ng/static/js/upload.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/webcit-ng/static/js/upload.js b/webcit-ng/static/js/upload.js index 6dbd92e64..2d0751baf 100644 --- a/webcit-ng/static/js/upload.js +++ b/webcit-ng/static/js/upload.js @@ -12,7 +12,10 @@ var uploads = [] ; // everything the user has uploaded // Remove the upload window completely (even if it's hidden) function deactivate_uploads() { - document.getElementById("ctdl-upload").remove(); + upload_window = document.getElementById('ctdl-upload'); + if (upload_window) { + upload_window.remove(); + } } @@ -151,7 +154,11 @@ function show_or_hide_upload_window() { // Flush all uploaded files and close the window function flush_uploads() { - document.getElementById('ctdl-upload').style.display='none'; + upload_window = document.getElementById('ctdl-upload'); + + if (upload_window) { + upload_window.style.display='none'; + } // FIXME tell the server to delete the files uploads.forEach(u => { -- 2.30.2