Skip to content

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

@jdelStrother

Description

@jdelStrother

Hi,
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions