Skip to content

Commit

Permalink
Fix directly uploading zero-byte files
Browse files Browse the repository at this point in the history
Closes #33450.
  • Loading branch information
georgeclaghorn committed Jul 27, 2018
1 parent 36f28fd commit 1954637
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion activestorage/app/assets/javascripts/activestorage.js
Expand Up @@ -484,7 +484,7 @@
}, {
key: "readNextChunk",
value: function readNextChunk() {
if (this.chunkIndex < this.chunkCount) {
if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {
var start = this.chunkIndex * this.chunkSize;
var end = Math.min(start + this.chunkSize, this.file.size);
var bytes = fileSlice.call(this.file, start, end);
Expand Down
Expand Up @@ -39,7 +39,7 @@ export class FileChecksum {
}

readNextChunk() {
if (this.chunkIndex < this.chunkCount) {
if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {
const start = this.chunkIndex * this.chunkSize
const end = Math.min(start + this.chunkSize, this.file.size)
const bytes = fileSlice.call(this.file, start, end)
Expand Down

0 comments on commit 1954637

Please sign in to comment.