From 7ce23c6b54ead769af21e1fb268b116964d44d4d Mon Sep 17 00:00:00 2001 From: Brayan Jules Date: Fri, 27 Feb 2026 11:46:42 -0300 Subject: [PATCH] fix(ecstore): allow trailing slash in object names to match S3 behavior (#1996) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: heihutu <30542132+heihutu@users.noreply.github.com> Co-authored-by: 安正超 --- crates/ecstore/src/bucket/utils.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/ecstore/src/bucket/utils.rs b/crates/ecstore/src/bucket/utils.rs index 4721498b1..3ea13301f 100644 --- a/crates/ecstore/src/bucket/utils.rs +++ b/crates/ecstore/src/bucket/utils.rs @@ -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("."));