Skip to content

Commit

Permalink
Display error message when invalid server response was received, chec…
Browse files Browse the repository at this point in the history
…k if incorrect nginx config #164
  • Loading branch information
Forceu committed May 23, 2024
1 parent 5fcd264 commit 1729200
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions internal/webserver/web/static/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ Dropzone.options.uploaddropzone = {
this.on("sending", function(file, xhr, formData) {
isUploading = true;
});

// Error handling for chunk upload, especially returning 413 error code (invalid nginx configuration)
this.on("error", function(file, errorMessage, xhr) {
if (xhr && xhr.status === 413) {
showError(file, "File too large to upload. If you are using a reverse proxy, make sure that the allowed body size is at least 50MB.");
} else {
showError(file, "Server responded with code " + xhr.status);
}
});

this.on("uploadprogress", function(file, progress, bytesSent) {
updateProgressbar(file, progress, bytesSent);
});
Expand All @@ -45,6 +55,8 @@ Dropzone.options.uploaddropzone = {
},
};



function updateProgressbar(file, progress, bytesSent) {
let chunkId = file.upload.uuid;
let container = document.getElementById(`us-container-${chunkId}`);
Expand Down
Loading

0 comments on commit 1729200

Please sign in to comment.