Skip to content

Commit

Permalink
Use filename option
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Feb 13, 2023
1 parent 1686ae4 commit ed29b90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/blazer/queries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def render_run
# not ideal, but useful for testing
raise Error, @error if @error && Rails.env.test?

send_data csv_data(@columns, @rows, @data_source), type: "text/csv; charset=utf-8; header=present", disposition: "attachment; filename=\"#{@query.try(:name).try(:parameterize).presence || 'query'}.csv\""
send_data csv_data(@columns, @rows, @data_source), type: "text/csv; charset=utf-8", disposition: "attachment", filename: "#{@query.try(:name).try(:parameterize).presence || 'query'}.csv"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/queries_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_smart_columns
def test_csv
run_query("SELECT 1 AS id, 'Chicago' AS city", format: "csv")
assert_equal "id,city\n1,Chicago\n", response.body
assert_equal "attachment; filename=\"query.csv\"", response.headers["Content-Disposition"]
assert_equal "attachment; filename=\"query.csv\"; filename*=UTF-8''query.csv", response.headers["Content-Disposition"]
assert_equal "text/csv; charset=utf-8", response.headers["Content-Type"]
end

Expand Down

0 comments on commit ed29b90

Please sign in to comment.