Attachments on S3 do not escape '%' in URLs #563

Closed
indirect opened this Issue Aug 23, 2011 · 0 comments

Projects

None yet

2 participants

@indirect

When using S3 to save an image named "Screen%20shot%202011-07-06%20at%2012.56.16.png", Paperclip generates a URL that is not escaped correctly. The generated URL returns a 401 error from S3, since it does not exist.

> playlist_item.thumb.url
=> "https://s3.amazonaws.com/bucket/thumbs/original/409/Screen%20shot%202011-07-06%20at%2012.56.16.png?1314058733"

However, if you manually escape the percent signs in the file name, you end up with a URL that actually works and retrieves the file that Paperclip saved earlier:

> playlist_item.thumb.url.gsub('%', '%25')
=> "https://s3.amazonaws.com/bucket/thumbs/original/409/Screen%2520shot%25202011-07-06%2520at%252012.56.16.png?1314058733"

That URL actually works, but I'd really rather not have to add a gsub everywhere that I call the Paperclip #url method. :)

@sikachu sikachu added a commit that closed this issue Sep 23, 2011
@sikachu sikachu Return a URI.escape'd URL from attachment
It's Paperclip's responsibility to escape special characters from the URL to make sure that it's comply with standard.

Closes #577, Closes #563, and reverse my judgement on #482.
23cb822
@sikachu sikachu closed this in 23cb822 Sep 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment