Home > Software engineering >  Firebase storage download integrity
Firebase storage download integrity

Time:03-17

I can't find any piece of documentation stating that the Firebase storage client will be checking the downloaded file's hash against the one on the server. Surely there exists the error code ERROR_INVALID_CHECKSUM but as the documentation states:

File on the client does not match the checksum of the file received by the server. Try uploading again.

And it looks like this error might only occur by uploading, and not while downloading the file. So I'm asking if anyone has more knowledge on the matter, cause I'm concerned that the downloaded files can be corrupted and a re-download might be required.

Thanks in advance.

CodePudding user response:

That ERROR_INVALID_CHECKSUM can only occur when uploading a file.

The client creates a crc32 signature or md5 hash of the data being uploaded, and then the server, once it receives the bytes, also creates a crc32 or md5 hash and returns it with the final http response to the client.

If the code from the server does not match that fromm the client, the client throws the ERROR_INVALID_CHECKSUM error.

No such check happens on a download though. If your callback gets invoked, the only assumption you can do is that download has completed successfully. You could technically compare the md5 that is stored in the metadata with the actual blob data, but I don't think the SDK actually does that.

  • Related