-
Notifications
You must be signed in to change notification settings - Fork 3k
[#70243] Fix FrozenError when diffing commits
#21504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/17.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a FrozenError that occurs when diffing commits. The error happens when attempting to call force_encoding on a frozen string literal without first creating a mutable copy.
Key Changes
- Added
.dupbefore.force_encoding("UTF-8")in theline_to_htmlmethod to handle frozen string literals correctly
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
FrozenError when diffing commits
| DIFF | ||
| end | ||
|
|
||
| it "handles frozen strings without raising FrozenError" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked Copilot to generate a spec, but I'm not convinced of its usefulness. I don't think we need to check every method doesn't error with an assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are totally useless: the tests still pass if we revert back to the old code without calling dup.
Either we find better tests, or we remove them.
What makes the input string with repositories so special that it creates a FrozenError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests do not fail if the previous code is used. They should fail.
| DIFF | ||
| end | ||
|
|
||
| it "handles frozen strings without raising FrozenError" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are totally useless: the tests still pass if we revert back to the old code without calling dup.
Either we find better tests, or we remove them.
What makes the input string with repositories so special that it creates a FrozenError?
FrozenError when diffing commitsFrozenError when diffing commits
Ticket
https://community.openproject.org/projects/openproject/work_packages/70243
What are you trying to accomplish?
Fixes a Ruby
FrozenError.Possibly a result of 50be32c / #19980
Merge checklist