Browse Source

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.
pull/7550/head
Chris Lu 3 days ago
parent
commit
28fc613a50
  1. 4
      weed/s3api/s3api_object_handlers.go

4
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 { 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) return fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, object)
} }

Loading…
Cancel
Save