-
Notifications
You must be signed in to change notification settings - Fork 389
Labels
api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.externalThis issue is blocked on a bug with the actual product.This issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- OS: Windows 10 Pro 1809
- Node.js version: v10.15.3 LTS
- npm version: 6.4.1
@google-cloud/storage
version: 2.5.0
Steps to reproduce
- Prepare a bucket with Cloud KMS Customer managed Key encryption. All files are private.
- Upload an JPEG image file using:
function UploadFile() {
storage.bucket("somebucket").upload("somefolder/someimage.jpg", {
gzip: true,
destination: "somefolder/someimage.jpg",
}).then(results => {
console.log("upload OK");
})
.catch(err => {
console.error("Error: ", err);
});
}
UploadFile()
// Upload works fine.
- Try downloading the img file using:
function DownloadFile() {
const file = storage.bucket("somebucket").file("somefolder/someimage.jpg");
file.download({
destination: "someimage.jpg",
// validation: false, // Why even disable validation?
}).then(res => {
console.log("DL OK");
}).catch(err => {
console.error(err); // Throws CONTENT_DOWNLOAD_MISMATCH
})
}
DownloadFile()
- Correct decompressed file is downloaded AND exception is thrown:
code=CONTENT_DOWNLOAD_MISMATCH message=The downloaded data did not match the data from the server. To be sure the content is the same, you should download the file again.
I've read through Issue 566, but seems like not a solution.
storage.bucket("somebucket").file("somefolder/someimage.jpg").download({validation: false});
works, but there's no reason to or should disable validation.
To make sure if the hashes are actually a mismatch, I ran a local md5sum check on the downloaded and original image files.
$ md5sum downloaded.jpg original.jpg
a045a2e8e6b8d84aa8a319bcdba05419 downloaded.jpg
a045a2e8e6b8d84aa8a319bcdba05419 original.jpg
Downloaded file is a match to the original file.
BTW, This problem doesn't happen if the image is not gzipped on upload.
Thanks
jiyu3, Meemaw, lukeggchapman, danielwhatmuff, vially and 4 more
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.externalThis issue is blocked on a bug with the actual product.This issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.