Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


QR causes Rails' send_file to send 0kb files #6

jdelStrother opened this Issue · 0 comments

1 participant


If query_reviewer is enabled, it has the 'interesting' side effect of making send_file send 0kb files. This is due to calling 'response.body' in add_query_output_to_view, which then reads the entire File object into a string in ActionDispatch::Response#each, meaning that when Rack tries to return the file, it's already read to the end and just returns an empty string.

Before calling response.body, we might fetch the response ivar @body and check that it's not a file, or check the headers to see they include sendfile stuff. Or we could rewind the file, assuming you can figure out that it was a file in the first place. None of those options sound very appealing.

I'm not sure there's a good solution to this, but it took a really long time to track down and I thought I'd mention it for future googlers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.