Repository navigation
Reject '+'-signed numeric character references in HTML paste - #1252
Open
Silvertree2010 wants to merge 1 commit into
Open
Silvertree2010 wants to merge 1 commit into
Silvertree2010 wants to merge 1 commit into
Conversation
Found while testing crates/engine/src/cmd/richclip.rs:301-304 (numeric_char, used by decode_text) Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
This branch has not been deployed
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.
Found while testing
crates/engine/src/cmd/richclip.rs:301-304 (numeric_char, used by decode_text)(no existing issue): HTML paste decodes numeric entities with a '+' sign (&#+65; becomes 'A').Cause
numeric_charparsed entity digits withstr::parse::<u32>()andu32::from_str_radix(.., 16). Both accept a leading '+', so the malformed references&#+65;and&#x+41;were decoded as 'A' instead of being kept as typed.Fix
numeric_charnow returns None unless the digits are non-empty and every character is a valid digit for the radix (decimal, or hex after the x/X prefix). Malformed references then fall through to the existing keep-as-typed path indecode_text. The new test covers both '+' cases and checks thatAandAstill decode to 'A'.Verified
cmd::richclip::tests::signed_numeric_entities_are_kept_as_typed: fails onmainwithout the fix and passes with it (cargo test -p deckcraft-engine --lib signed_numeric_entities_are_kept_as_typed).cargo xtask cipasses excepttests::east_asian_vertical_text_stands_ideographs_upright, which also fails onmainwithout this change.Not changed
The similar '+' issue in
Rgba::from_hexis a separate parser and is not changed here.🤖 Generated with AI by ApolloOffice, see the Co-Authored-By trailers for the models
Summary by CodeRabbit