mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-17 01:30:33 +00:00
fix: normalize ETag comparison in multipart upload and replication (#627)
- Normalize ETags by removing quotes before comparison in complete_multipart_upload - Fix ETag comparison in replication logic to handle quoted ETags from API responses - Fix ETag comparison in transition object logic - Add unit tests for trim_etag function This fixes the ETag mismatch error when uploading large files (5GB+) via multipart upload, which was caused by PR #592 adding quotes to ETag responses while internal storage remains unquoted. Fixes #625
This commit is contained in:
@@ -276,6 +276,27 @@ pub fn trim_etag(etag: &str) -> String {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_trim_etag() {
|
||||
// Test with quoted ETag
|
||||
assert_eq!(trim_etag("\"abc123\""), "abc123");
|
||||
|
||||
// Test with unquoted ETag
|
||||
assert_eq!(trim_etag("abc123"), "abc123");
|
||||
|
||||
// Test with empty string
|
||||
assert_eq!(trim_etag(""), "");
|
||||
|
||||
// Test with only quotes
|
||||
assert_eq!(trim_etag("\"\""), "");
|
||||
|
||||
// Test with MD5 hash
|
||||
assert_eq!(trim_etag("\"2c7ab85a893283e98c931e9511add182\""), "2c7ab85a893283e98c931e9511add182");
|
||||
|
||||
// Test with multipart ETag format
|
||||
assert_eq!(trim_etag("\"098f6bcd4621d373cade4e832627b4f6-2\""), "098f6bcd4621d373cade4e832627b4f6-2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_base_dir_from_prefix() {
|
||||
let a = "da/";
|
||||
|
||||
Reference in New Issue
Block a user