Fix binary court report downloads - #7109
Open
alloutflo wants to merge 1 commit into
Open
Conversation
alloutflo
requested review from
FireLemons,
compwron and
elasticspoon
as code owners
August 9, 2026 04:23
Author
|
CI note: the Brakeman failure is unrelated to this diff. Its only warning is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What github issue is this PR for, if any?
Resolves #7099
What changed, and why?
File.binread, so the response body remains binary (ASCII-8BIT) instead of being tagged as invalid UTF-8 text.#{@casa_case.case_number}.docxexplicitly tosend_data, so escaped characters in the request URL cannot alter the downloaded filename.Content-Disposition.#and a deliberately different stored blob name, so the regression covers the reported filename edge case.The new example fails against the old controller implementation because the response has the wrong encoding and no explicit filename, then passes with this change.
How is this tested? (please write rspec and jest tests!) 💖💪
bundle exec rspec spec/requests/case_court_reports_spec.rb:55— 4 examples, 0 failuresbundle exec standardrb app/controllers/case_court_reports_controller.rb spec/requests/case_court_reports_spec.rb— passedruby -cfor both changed Ruby files — passedgit diff --check— passedspec/requests/case_court_reports_spec.rb: 27 examples passed; three unchanged index examples could not render because the local test setup did not contain the builtapplication.jsasset. The focused DOCX context and all changed-code checks pass.Screenshots please :)
Not applicable; this changes the binary download response and request coverage, with no visual UI changes.
Feelings gif (optional)
AI disclosure: I used an AI coding assistant to help inspect the issue, implement the focused change and regression coverage, and run the checks listed above. I reviewed the final diff and test results before submitting.