I have code which lists keys using ListObjectsPages
->Contents
->Key
and copies those keys using CopyObject
. This works in general but for some keys it's complaining NoSuchKey: The specified key does not exist.
The set of keys it's complaining about include keys with +
.
-
ListObjectsPages
returns key "foo+bar". -
CopyObject
on "foo+bar" gives theNoSuchKey
error. -
CopyObject
on "foo bar" (unescaped) gives theNoSuchKey
error.
Oddly, if I use the CLI: aws s3 cp
on "foo+bar", the copy works. But I can't use the CLI. I need to use the sdk.
I'm using v1.8.11
As Rayfen mentioned, the plus characters could be the result of space replacement.
Update:
Everything was hashed out here https://github.com/aws/aws-sdk-go/issues/1438. Rayfen was right about needing to QueryEscape
. I'm going to award the only current answer with the bounty since it adds useful information, but not select it as correct.