rclone: Wrong encoding type in response when using "serve s3" - should not be url-encoded

I’m currently testing the rclone serve s3 feature under v1.66 and it works with some clients but not some others. After digging a few hours I noticed that compared to other S3 services (here with MinIO), rclone returns the value inside <Key> (= filenames) as a URL-encoded string, while no <EncodingType> node in the response indicates this content type is in use.

While it’s a bit unclear in the specs, in that case the client should expect a proper UTF-8 string and so it leads to issues when it reuses and re-URL-encode it before sending a HeadObject request for example, because it returns a 404.

The doc says Encoding type used by Amazon S3 to encode the object keys in the response. Responses are encoded only in UTF-8. so unless you pass the content-encoding=url parameter in the query, returned filenames should not be encoded that way.

Expected: <Key>Æther Realm/[2011] Odin Will Provide/cover.jpg</Key> Actual: <Key>%C3%86ther+Realm/%5B2011%5D+Odin+Will+Provide/cover.jpg</Key>

I’ve tried with two different rclone backends: WebDAV and the local filesystem. The result is the same.

The test has been performed with Azuracast, which uses the official aws-sdk-php library for the heavy lifting. We can then assume this is not because of an invalid custom adapter.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@PatrickHuetter wrote

mkdir -p /config
echo "$RCLONE_CONFIG_CONTENT" > /config/rclone.conf
exec rclone serve s3 media:/mnt/media/documents/archive --auth-key $ACCESS_KEY_ID,$SECRET_ACCESS_KEY --transfers 20 --local-unicode-normalization --read-only --vfs-cache-mode full --addr :80 --config $RCLONE_AUTH_PROXY_BACKENDS

I removed the --local-unicode-normalization and tested again but now the file is completely missing although the file exists. I’m testing further.

The *.pdf file was created and renamed on MacOS and uploaded then to paperless-ngx.

UPDATE: I don’t know why but now it works! It seems that removing --local-unicode-normalization and flushing rclone vfs cache helped.

As you probably know mac is a bit weird about its unicode file names liking to produce denormalised UTF-8.

Not sure which bit of the stack has the problem though! If you’ve made it work, I’m going to leave that can of worms tightly closed 😃