nodejs-storage
nodejs-storage copied to clipboard
Supplying a complex object (i.e. buffer) as an argument to md5Hash or crc32c does not invoke server validation
In the course of investigating #1829 we discovered that if a complex object (buffer in the example) is provided as the argument to metadata.md5Hash
or metadata.crc32c
the server ignores the argument and does not perform server validation. The expectation in testing was that when invalid input was provided the server would return a 400 error complaining that the provided hash/checksum was not encoded correctly. If an invalid string is provided, an error is correctly returned.
TODO: look into this further after https://github.com/googleapis/gaxios/pull/475 is merged
Reducing this to a p3 as when provided a string this works as expected.
Tagged as external because this is an issue with the gaxios
dependency.
Re-visiting this today I took a look at the JSON docs. Both MD5 and CRC32C are defined as strings. As such I do not think the library should handle the case of different types being supplied as the argument. This will also become more evident when we add stronger typings: https://github.com/googleapis/nodejs-storage/issues/1817. As a result I am going to close this out as I think the real work is captured there.