Skip to content

Fix zerobytesfileupload #1883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Change Log: `bootstrap-fileinput`

**Date**: _under development_

- (enh #1879): Correct getTotalChunks to return valid count even if 0 byte file
- (enh #1878): Correct rotated images behavior in zoom modal dialog.
- (enh #1876): Correct variable initialization for folder drag & drop.
- (enh #1875): Correct locale language fallback if unspecified.
Expand Down Expand Up @@ -1679,4 +1680,4 @@ Initial release. The following features are included in this release:
- Upload action defaults to form submit. Supports an upload route/server action parameter for custom ajax based upload.
- Triggers JQuery events for advanced development. Events currently available are `filereset` and `fileclear`.
- Disabled and readonly file input support.
- Size of the entire plugin is less than 11KB (about 9KB for the minified JS and 2KB for the minified CSS).
- Size of the entire plugin is less than 11KB (about 9KB for the minified JS and 2KB for the minified CSS).
2 changes: 1 addition & 1 deletion js/fileinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@
getTotalChunks: function () {
var chunkSize = parseFloat(rm.chunkSize);
if (!isNaN(chunkSize) && chunkSize > 0) {
return Math.ceil(rm.file.size / chunkSize);
return rm.file.size === 0 ? 1 : Math.ceil(rm.file.size / chunkSize); //even if file size is 0, totalChunk will be 1
}
return 0;
},
Expand Down
2 changes: 1 addition & 1 deletion js/fileinput.min.js

Large diffs are not rendered by default.