Reputation: 1163
I uploaded an image called
'Pepper, Pig (#PP).jpg'
to my S3 bucket. I noticed that the corresponding object url created by AWS is:
'Pepper#2C+Pig+(%23PP.jpg)'
In other words, it converts all of the spaces into + and converts the comma and the hash into hex. It does not change the parentheses.
Does this type of encoding have a special name? And is there some way to convert strings into this AWS object url naming convention?
Upvotes: 2
Views: 2307
Reputation: 1163
As John pointed out in the comments, the AWS title is url encoded, so in python, so to convert the S3 object name to the S3 object url, we can just use:
import urllib
object_name = 'Pepper, Pig (#PP).jpg'
object_url = urllib.parse.quote_plus(title)
The results is:
'Pepper%2C+Pig+%28%23PP%29.jpg'
Which works perfectly as when referencing this object in S3.
Upvotes: 3