From 701c2be63f33a868f0369fe95d823ed0b11ec683 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Sun, 24 Feb 2019 20:44:24 +0100 Subject: Ensure upload progress stays within bounds --- frontend/js/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'frontend') diff --git a/frontend/js/app.js b/frontend/js/app.js index 7a80ba7..e446db3 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -171,7 +171,8 @@ function uploadFiles(files) { if (!(event.target instanceof XMLHttpRequestUpload)) return; app.uploadStatus.done = finishedUploadSize + event.loaded; - app.uploadStatus.percentDone = Math.round(app.uploadStatus.done / app.uploadStatus.size * 100); + var tmp = Math.round(app.uploadStatus.done / app.uploadStatus.size * 100); + app.uploadStatus.percentDone = tmp > 100 ? 100 : tmp; }).end(function (error, result) { if (result && result.statusCode === 401) return logout(); if (result && result.statusCode !== 201) return callback('Error uploading file: ', result.statusCode); -- cgit v1.2.3