s3:标题中嵌入“:”的流式文件

s3: streaming file(s) with embedded ':' in title

由于各种历史原因,我在 s3 上看到了一系列文件,这些文件的标题中的时间表示为 'HH:MM:SS'(以及其他字符)。文件名通过 SQS 连同其他没有这些字符的文件一起传给我。

我可以在文件中读到 包含 ':' 字符就好了,但我没有成功地处理那些包含字符的文件。我尝试了各种 UUEncode/Decode 过程,但一切都给我这个错误:

Caught an AmazonServiceException, which means your request made it to Amazon S3, 
but was rejected with an error response for some reason.

Error Message: The specified key does not exist. 
(Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey;

我想知道是否有某种方法可以对密钥进行编码以便可以访问文件。

文档指出冒号字符属于可能需要特殊处理的字符(请参阅 docs):

The following characters in a key name may require additional code handling and will likely need to be URL encoded or referenced as HEX.

根据this list,冒号字符的十六进制值为%3A

换句话说,当您指定密钥时,将您的“:”字符替换为“%3A”,它应该可以正常工作。