title: Rails - Issues Downloading S3 File using Fog/Carrierwave
body: <p>I have a Rails application where I am storing a file on S3 using Fog/Carrierwave. When I go to download the file, I do not get the expected results. My code is the following:</p>
  
  <pre><code>v_file_name = "https://s3.amazonaws.com/{bucket}/{file}.pdf"
  
  data = open(URI.parse(URI.encode(v_file_name)))
  
  send_data data, :type =&gt; 'application/pdf', :disposition =&gt; 'attachment', :filename =&gt; "{filename}.pdf"
  </code></pre>
  
  <p>I expect to get the download file dialog, but I get redirected in the browser to a page that begins with: </p>
  
  <pre><code>%PDF-1.3 %���� 1 0 obj &lt;&lt; /Creator /Producer &gt;&gt; endobj 2 0 obj....
  </code></pre>
  
  <p>And ending in:</p>
  
  <pre><code>..... &lt;&lt; /Size 10 /Root 2 0 R /Info 1 0 R &gt;&gt; startxref 25361 %%EOF
  </code></pre>
  
  <p>This code had previously been working, but has suddenly stopped working. </p>
  
  <p>Any help would be greatly appreciated!</p>