-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
🚨This issue needs some love.This issue needs some love.api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.triage meI really want to be triaged.I really want to be triaged.
Description
The http response from google may not always has 'x-goog-hash' header. When it happens, the node process will exit.
Need fix like:
diff --git a/node_modules/gcloud/lib/storage/file.js b/node_modules/gcloud/lib/storage/file.js
index 8e1a26e..4aaec72 100644
--- a/node_modules/gcloud/lib/storage/file.js
+++ b/node_modules/gcloud/lib/storage/file.js
@@ -361,10 +361,12 @@
var md5Fail = true;
var hashes = {};
- res.headers['x-goog-hash'].split(',').forEach(function(hash) {
- var hashType = hash.split('=')[0];
- hashes[hashType] = hash.substr(hash.indexOf('=') + 1);
- });
+ if (res.headers && res.headers['x-goog-hash']) {
+ res.headers['x-goog-hash'].split(',').forEach(function(hash) {
+ var hashType = hash.split('=')[0];
+ hashes[hashType] = hash.substr(hash.indexOf('=') + 1);
+ });
+ }
var remoteMd5 = hashes.md5;
var remoteCrc = hashes.crc32c && hashes.crc32c.substr(4);Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.triage meI really want to be triaged.I really want to be triaged.