aliyun / alibabacloud-oss-sdk

The OSS SDK. Powered by Darabonba.
Apache License 2.0
20 stars 8 forks source link

Fix CRC checks on VerifyStream #286

Open nosammai opened 7 months ago

nosammai commented 7 months ago

Currently I am getting CrcNotMatched errors when I try to upload files. The CRC returned by the server is the correct CRC but the client is calculating an incorrect CRC.

With the current logic, the last chunk of the file will not be calculated into the CRC and MD5 hashes because the size of bytes left in the file is less than the read size.

       if size <= self._file_size:
            self.crc.update(bres)
            self.md5.update(bres)

This patch will ensure the whole file is used to calculate the CRC and MD5 hashes.

CLAassistant commented 7 months ago

CLA assistant check
All committers have signed the CLA.