From 28fc613a50c75c12beb5853c544fdd79b9c6aeb5 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 25 Nov 2025 22:21:49 -0800 Subject: [PATCH] Fix toFilerPath: remove URL escaping for raw file paths The toFilerPath function should return raw file paths, not URL-escaped paths. URL escaping was needed when the path was embedded in a URL (old toFilerUrl), but now that we pass paths directly to putToFiler, they should be unescaped. This fixes S3 integration test failures: - test_bucket_listv2_encoding_basic - test_bucket_list_encoding_basic - test_bucket_listv2_delimiter_whitespace - test_bucket_list_delimiter_whitespace The tests were failing because paths were double-encoded (escaped when stored, then escaped again when listed), resulting in %252B instead of %2B for '+' characters. Root cause: When we removed URL parsing in putToFiler, we should have also removed URL escaping in toFilerPath since paths are now used directly without URL encoding/decoding. --- weed/s3api/s3api_object_handlers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index d8b0648ff..b1446c3e7 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -405,7 +405,9 @@ func newListEntry(entry *filer_pb.Entry, key string, dir string, name string, bu } func (s3a *S3ApiServer) toFilerPath(bucket, object string) string { - object = urlPathEscape(removeDuplicateSlashes(object)) + // Returns the raw file path - no URL escaping needed + // The path is used directly, not embedded in a URL + object = removeDuplicateSlashes(object) return fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, object) }