Checksum verification when uploading file to cloud storage not working - version 2.36.1
Closed this issue · 2 comments
Hi,
I am trying to set md5 verification when I upload file as follows:
BlobId blobId = BlobId.of(bucketName, filePath);
BlobInfo.Builder blobInfoBuilder = BlobInfo.newBuilder(blobId);
blobInfoBuilder .setMd5FromHexString(md5Hex);
BlobInfo blobInfo = blobInfoBuilder.build();
WriteChannel writeChannel = getWriteChannel(blobInfo);
writeChannel.setChunkSize(gcsChunkSize);
OutputStream gcsOutputStream = Channels.newOutputStream(writeChannel);
gcsOutputStream .write();
gcsOutputStream.close();
Any md5 hex I am giving doesn't produce an error.
Does the server verify this MD5?
Thanks,
Itay
What @ddelgrosso1 says is correct. The option must be passed when calling Storage#writer
.
For a full code sample, take a look at our integration tests that verify checksum validation works via positive and negative cases: