b2-sdk-php icon indicating copy to clipboard operation
b2-sdk-php copied to clipboard

Image Blob gets 'Sha1 did not match data received'

Open czzplnm opened this issue 6 years ago • 3 comments

If I try to send an imageBlob as the body I get from Backblaze:

Sha1 did not match data received

Can we send raw data in the body, without using a file object?

czzplnm avatar Oct 01 '18 02:10 czzplnm

I've also been experiencing an issue similar. I installed this SDK via composer on 2 systems - one running PHP5 & Apache and the other PHP7 & nginx. The PHP5 system worked, however I also got an error relating to the SHA1 hash not matching.

From looking around a few other Github repositories for PHP SDKs for B2 (https://github.com/gliterd/backblaze-b2/pull/16), it seems that the issue may be with the use of mb_strlen at https://github.com/cwhite92/b2-sdk-php/blob/master/src/Client.php#L197 I changed this to strlen, and the error was no longer present after this change.

Hope this is of use to you.

Matthew-Kilpatrick avatar Oct 31 '18 18:10 Matthew-Kilpatrick

I've also been experiencing an issue similar. I installed this SDK via composer on 2 systems - one running PHP5 & Apache and the other PHP7 & nginx. The PHP5 system worked, however I also got an error relating to the SHA1 hash not matching.

From looking around a few other Github repositories for PHP SDKs for B2 (gliterd/backblaze-b2#16), it seems that the issue may be with the use of mb_strlen at https://github.com/cwhite92/b2-sdk-php/blob/master/src/Client.php#L197 I changed this to strlen, and the error was no longer present after this change.

Hope this is of use to you.

Awesome! I've been writing my image blob to a file as a quick work around, but I'll implement this fix when I get home, thanks!

czzplnm avatar Oct 31 '18 19:10 czzplnm

I forked the repo and merging the PRs in there. You can access it here: https://github.com/tarikozket/b2-sdk-php

tarikozket avatar Dec 29 '18 01:12 tarikozket