Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Feature/903 allow empty file uploads #1673

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/js/uploader.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@

this._templating.updateProgress(id, loaded, total);

if (Math.round(loaded / total * 100) === 100) {
if (total === 0 || Math.round(loaded / total * 100) === 100) {
this._templating.hideCancel(id);
this._templating.hidePause(id);
this._templating.hideProgress(id);
Expand Down
6 changes: 5 additions & 1 deletion client/js/uploader.basic.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@
},

_formatSize: function(bytes) {
if (bytes === 0) {
return bytes + this._options.text.sizeSymbols[0];
}

var i = -1;
do {
bytes = bytes / 1000;
Expand Down Expand Up @@ -1797,7 +1801,7 @@
return validityChecker.failure();
}

if (size === 0) {
if (!this._options.validation.allowEmpty && size === 0) {
this._itemError("emptyError", name, file);
return validityChecker.failure();
}
Expand Down