fix(ecstore): allow trailing slash in object names to match S3 behavior (#1996)

Co-authored-by: heihutu <30542132+heihutu@users.noreply.github.com>
Co-authored-by: 安正超 <anzhengchao@gmail.com>
This commit is contained in:
Brayan Jules
2026-02-27 11:46:42 -03:00
committed by GitHub
parent dcbc67eb91
commit 7ce23c6b54
+4 -8
View File
@@ -193,10 +193,6 @@ pub fn is_valid_object_name(object: &str) -> bool {
return false;
}
if object.ends_with(SLASH_SEPARATOR) {
return false;
}
is_valid_object_prefix(object)
}
@@ -379,10 +375,10 @@ mod tests {
// Invalid cases - empty string
assert!(!is_valid_object_name(""));
// Invalid cases - ends with slash (object names cannot end with slash)
assert!(!is_valid_object_name("object/"));
assert!(!is_valid_object_name("path/to/file/"));
assert!(!is_valid_object_name("ends/with/slash/"));
// Valid cases - trailing slash is allowed (empty object with trailing slash)
assert!(is_valid_object_name("object/"));
assert!(is_valid_object_name("path/to/file/"));
assert!(is_valid_object_name("ends/with/slash/"));
// Invalid cases - bad path components (inherited from is_valid_object_prefix)
assert!(!is_valid_object_name("."));