Commit 456a7fd Hang Le
committed
File tree 1 file changed +7
-4
lines changed
swift_browser_ui_frontend/wasm/js
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -287,10 +287,12 @@ class FileSlicer {
287
287
async concatFile ( ) {
288
288
// If the file can't be decrypted, add the header and concat the encrypted
289
289
// file to the stream
290
- if ( this . output instanceof WritableStream ) {
291
- await this . output . write ( downloads [ this . id ] . files [ this . path ] . header ) ;
292
- } else {
293
- this . output . enqueue ( downloads [ this . id ] . files [ this . path ] . header ) ;
290
+ if ( downloads [ this . id ] . files [ this . path ] . header . length > 0 ) {
291
+ if ( this . output instanceof WritableStream ) {
292
+ await this . output . write ( downloads [ this . id ] . files [ this . path ] . header ) ;
293
+ } else {
294
+ this . output . enqueue ( downloads [ this . id ] . files [ this . path ] . header ) ;
295
+ }
294
296
}
295
297
296
298
await this . getStart ( ) ;
@@ -306,6 +308,7 @@ class FileSlicer {
306
308
this . output . enqueue ( new Uint8Array ( this . chunk ) ) ;
307
309
}
308
310
this . totalBytes += this . chunk . length ;
311
+ totalDone += this . chunk . length ;
309
312
( { value : this . chunk , done : this . done } = await this . reader . read ( ) ) ;
310
313
311
314
if ( this . done && this . segmentOffset < downloads [ this . id ] . files [ this . path ] . realsize ) {
You can’t perform that action at this time.
0 commit comments