Skip to content

Commit

Permalink
fix: handle progress for empty files (#3260)
Browse files Browse the repository at this point in the history
When a file is empty the progress event will have a `Bytes` property
that is `0` so test if the property is not undefined rather than if
it is truthy.

Fixes #3255
  • Loading branch information
achingbrain authored Sep 2, 2020
1 parent b075732 commit 145075f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/add-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ module.exports = configure((api) => {
for await (let file of res.ndjson()) {
file = toCamel(file)

if (progressFn && file.bytes) {
progressFn(file.bytes)
} else {
if (file.hash !== undefined) {
yield toCoreInterface(file)
} else if (progressFn) {
progressFn(file.bytes || 0)
}
}
}
Expand Down

0 comments on commit 145075f

Please sign in to comment.