mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-31 09:18:28 +00:00
fix(checksums): reject md5 instead of silently returning crc32 (#4513)
The UnknownChecksumAlgorithmError message omitted crc64nvme and advertised the deprecated md5. Parsing "md5" also returned a Crc32 algorithm and its into_impl produced a 4-byte CRC32, so a caller asking for MD5 silently got the wrong digest. Enumerate the accepted algorithms (crc32, crc32c, crc64nvme, sha1, sha256) in the error message, remove the unused Md5 enum variant, and make parsing "md5" fail loudly. Add tests covering the message contents and the md5 parse error.
This commit is contained in:
@@ -36,7 +36,7 @@ impl fmt::Display for UnknownChecksumAlgorithmError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
r#"unknown checksum algorithm "{}", please pass a known algorithm name ("crc32", "crc32c", "sha1", "sha256", "md5")"#,
|
||||
r#"unknown checksum algorithm "{}", please pass a known algorithm name ("crc32", "crc32c", "crc64nvme", "sha1", "sha256")"#,
|
||||
self.checksum_algorithm
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user