fixes #1005
The upstream gcp aggressively closes the connection once it has received Content-Length bytes. However the @google-cloud/storage module doesn't handle this well and emits no event in this case. We were setting Content-Length because it's slightly more efficient and was important for our download progress bar (not anymore). The download should function fine without setting the Content-Length, and allows the storage stream to finish before closing the upstream socket.
This commit is contained in:
parent
e264d0da62
commit
6184a70ba4
4 changed files with 7 additions and 16 deletions
|
@ -162,8 +162,8 @@ function download(id, keychain, onprogress, canceller) {
|
|||
});
|
||||
|
||||
xhr.addEventListener('progress', function(event) {
|
||||
if (event.lengthComputable && event.target.status === 200) {
|
||||
onprogress([event.loaded, event.total]);
|
||||
if (event.target.status === 200) {
|
||||
onprogress(event.loaded);
|
||||
}
|
||||
});
|
||||
const auth = await keychain.authHeader();
|
||||
|
@ -171,7 +171,7 @@ function download(id, keychain, onprogress, canceller) {
|
|||
xhr.setRequestHeader('Authorization', auth);
|
||||
xhr.responseType = 'blob';
|
||||
xhr.send();
|
||||
onprogress([0, 1]);
|
||||
onprogress(0);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue