From 2e486f6d333acb6cd16982c47ca228bd036178bc Mon Sep 17 00:00:00 2001 From: SamBrishes Date: Thu, 14 May 2020 17:59:29 +0200 Subject: [PATCH] Additional Check for the file --- bl-plugins/backup/js/backup.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bl-plugins/backup/js/backup.js b/bl-plugins/backup/js/backup.js index 5c0ba3db..94862bab 100644 --- a/bl-plugins/backup/js/backup.js +++ b/bl-plugins/backup/js/backup.js @@ -1,6 +1,9 @@ jQuery(document).ready(function($) { $('#backupFile').change(function() { var file = this.files.length >= 1? this.files[0]: null; + if (file === null) { + return false; + } // Build Form Data var url = $('#jsform').attr("action") || window.location.href; @@ -17,14 +20,14 @@ jQuery(document).ready(function($) { mimeType: "multipart/form-data", contentType: false, processData: false, - error: function(jqXHR, status, error) { + error: function (jqXHR, status, error) { var data = jqXHR.responseJSON; var alert = $("
").addClass("alert alert-danger").text(data.message); $("#jsform .alert:not(.alert-primary)").remove(); $("#jstokenCSRF").after(alert); }, - success: function(data, status, jqXHR) { + success: function (data, status, jqXHR) { window.location.reload(); } });