diff options
author | George Claghorn <george@basecamp.com> | 2018-07-27 00:11:22 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-07-27 00:11:22 -0400 |
commit | 195463736cfe21971171aa911dfb45d25dc87354 (patch) | |
tree | 20c2b30bc17cabb1965c1b4a38c7778a225ee2c0 /activestorage/app | |
parent | 36f28fd8184a999f82bd8b0388e31798bd856ae0 (diff) | |
download | rails-195463736cfe21971171aa911dfb45d25dc87354.tar.gz rails-195463736cfe21971171aa911dfb45d25dc87354.tar.bz2 rails-195463736cfe21971171aa911dfb45d25dc87354.zip |
Fix directly uploading zero-byte files
Closes #33450.
Diffstat (limited to 'activestorage/app')
-rw-r--r-- | activestorage/app/assets/javascripts/activestorage.js | 2 | ||||
-rw-r--r-- | activestorage/app/javascript/activestorage/file_checksum.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activestorage/app/assets/javascripts/activestorage.js b/activestorage/app/assets/javascripts/activestorage.js index a22f644238..d3fd795a3a 100644 --- a/activestorage/app/assets/javascripts/activestorage.js +++ b/activestorage/app/assets/javascripts/activestorage.js @@ -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); diff --git a/activestorage/app/javascript/activestorage/file_checksum.js b/activestorage/app/javascript/activestorage/file_checksum.js index ffaec1a128..d46f276957 100644 --- a/activestorage/app/javascript/activestorage/file_checksum.js +++ b/activestorage/app/javascript/activestorage/file_checksum.js @@ -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) |