1
0
mirror of https://github.com/prasathmani/tinyfilemanager.git synced 2025-07-29 21:10:41 +02:00

Add JSON Parse Error Handling in Upload Script (#1196)

* Add JSON Parse Error Handling in Upload Script

* Update tinyfilemanager.php

* Update tinyfilemanager.php
This commit is contained in:
Fannie MC
2024-05-31 12:15:09 +08:00
committed by GitHub
parent 843e240757
commit a4d96e0eaf

View File

@@ -1398,10 +1398,14 @@ if (isset($_GET['upload']) && !FM_READONLY) {
toast('Error: Server Timeout'); toast('Error: Server Timeout');
}); });
}).on("success", function (res) { }).on("success", function (res) {
let _response = JSON.parse(res.xhr.response); try {
let _response = JSON.parse(res.xhr.response);
if(_response.status == "error") { if(_response.status == "error") {
toast(_response.info); toast(_response.info);
}
} catch (e) {
toast("Error: Invalid JSON response");
} }
}).on("error", function(file, response) { }).on("error", function(file, response) {
toast(response); toast(response);