Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I have a call to my documents controller the download action, to serve the client with a downloadable object retrieved from s3. However, OpenURL seems to have trouble parsing the URL paperclip has stored. This URL is visitable in the browser without any issue, but when attempted to open it in the controller I get a 403 Forbidden error.


  def download

    data = open(Document.find(params[:id]).upload.url)

    send_data, :type => data.content_type, :x_sendfile => true


an example URL would be


Error - OpenURI::HTTPError 403 Forbidden shooting up on the first line of the action when the URL is opened. Any idea what it might be?

1 Answer

0 votes
by (44.4k points)

Using String Interpolation worked for me, try this:

doc = order.document

attachments["Order.pdf"] ="#{doc}"))

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories