Repository navigation
Replace invalid characters in attribute names - #762
Merged
Merged
Conversation
Attribute names were HTML-escaped, but characters that the HTML syntax does not allow in an attribute name (controls, space, ", ', /, = and >) were kept, so a name containing them did not render as a single attribute. Replace each of these characters with "_" in top-level and nested attribute names. Names that are already valid render unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #762 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 459 465 +6
=========================================
+ Hits 459 465 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
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.
Attribute names were HTML-escaped, but characters that the HTML syntax does not allow in an attribute name (controls, space,
",',/,=and>) were kept, so a name containing them did not render as a single attribute.Each of these characters is now replaced with
_, in top-level and nested attribute names. Names that are already valid render unchanged, including@click,:class,[value],(click)and#ref. The same change is going into 2.2.2.Verification
The fuzzing and Active Admin runs used the change applied to v2.2.1 (the 2.2.2 code). The library change is the same on this branch.
Specs: 185 examples, 0 failures.
Fuzzing of attribute names, 100,000 random names, top-level and nested, comparing v2.2.1 with the change:
Fuzzing of whole trees, 20,000 random trees with plain values and 20,000 with unusual ones (invalid or mixed encodings, custom
to_s), using allowed attribute names: no difference from v2.2.1 in output, encoding,html_safe?or exception class. About a third of the trees render; the others raise the same way in both versions.Active Admin (
5cda8009d, Ruby 3.3.12, Rails 8.1):filesystem-changesandclass-reloadingprofiles also pass.The fuzzing was run on Ruby 4.0.9 only.
🤖 Generated with Claude Code