I'm using aws-android-sdk
to send files from Android app to S3. The filename contains specials character such as =
.
To do that, I use TransferUtility.upload(...)
as explained in this guide .
When passing a key containing special characters such as =
, the key is being URL encoded.
For example, the key:
year=2018/month=1/versions=1,2/my_file.txt
Becomes:
year%253D2018/month%253D1/versions%253D1%252C2/my_file.txt
How can I upload an S3 file from my Android application, while using special characters in it's key?
If you are partitioning your data on S3, it's a common practice to use = sign in the S3 key. Also interesting to note that the AWS SDK for iOS does not automatically encode the S3 keys.
The problem is that you are not following the key name convention described in this paragraph called Object Key Guidelines of Amazon S3.
Summary from the link:
The following character sets are generally safe for use in key names:
Alphanumeric characters [0-9a-zA-Z]
Special characters !, -, _, ., *, ', (, and )
The following are examples of valid object key names:
4my-organization
my.great_photos-2014/jan/myvacation.jpg
videos/2014/birthday/video1.wmv
Remove those special chars from the URL following the guideline and the problem will disappear
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.