From 3ac3315088091e59f04dc19962ada13f9e7873a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 1 Apr 2020 14:49:07 +0200 Subject: [PATCH] Call "OC.Util.humanFileSize" instead of global "humanFileSize" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents flooding the console on big file uploads with messages about "humanFileSize" being deprecated, which decreases the performance (even if the developer tools of the browser are not open) and in some cases even cause the upload to fail. Signed-off-by: Daniel Calviño Sánchez --- apps/files/js/file-upload.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index c7174d31848..9d0bf7ca9ea 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -18,7 +18,7 @@ * - TODO music upload button */ -/* global jQuery, humanFileSize, md5 */ +/* global jQuery, md5 */ /** * File upload object @@ -971,8 +971,8 @@ OC.Uploader.prototype = _.extend({ data.textStatus = 'notenoughspace'; data.errorThrown = t('files', 'Not enough free space, you are uploading {size1} but only {size2} is left', { - 'size1': humanFileSize(selection.totalBytes), - 'size2': humanFileSize($('#free_space').val()) + 'size1': OC.Util.humanFileSize(selection.totalBytes), + 'size2': OC.Util.humanFileSize($('#free_space').val()) }); } @@ -1171,9 +1171,9 @@ OC.Uploader.prototype = _.extend({ h = t('files', 'Uploading …'); } self._setProgressBarText(h, h, t('files', '{loadedSize} of {totalSize} ({bitrate})' , { - loadedSize: humanFileSize(data.loaded), - totalSize: humanFileSize(total), - bitrate: humanFileSize(data.bitrate / 8) + '/s' + loadedSize: OC.Util.humanFileSize(data.loaded), + totalSize: OC.Util.humanFileSize(total), + bitrate: OC.Util.humanFileSize(data.bitrate / 8) + '/s' })); self._setProgressBarValue(progress); self.trigger('progressall', e, data);