1
votes

My heroku + Rails 4 + paperclip w/ AWS s3 is generating the wrong path for the image file.

This is the url paperclip is generating...

http://s3.amazonaws.com/travelquotesys/companies/logos/000/000/001/original/index.jpg%3F1416856406

It should be

http://s3.amazonaws.com/travelquotesys/companies/logos/000/000/001/original/index.jpg?1416856406

For some odd reason paperclip is generating the %3F instead of ? I don't know why it does that. I have a few Apps running on Heroku and this is the only one with this problem.

2

2 Answers

4
votes

Your issue is related to a recent commit which doesn't properly escape the timestamp. A temporary workaround is to disable the timestamp while a fix is worked-out.

company.logo(:original, timestamp:false) # or whatever style you're using

Or you can disable this globally by putting the following line within your config/initializers/paperclip.rb file.

Paperclip::Attachment.default_options[:use_timestamp] = false
1
votes

The issue is that Paperclip is escaping the url, so the character ? is escaped to %3F. To solve this issue add the following option to the S3 configuration:

escape_url: false

Hope it helps!