Skip to content

fix(oxvg_collections): don't split lists at escaped separators - #298

Merged
noahbald merged 1 commit into
noahbald:mainfrom
happyarts:fix/list-of-escapes
Sep 30, 2026
Merged

noahbald merged 1 commit into
noahbald:mainfrom
happyarts:fix/list-of-escapes

Conversation

@happyarts

@happyarts happyarts commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

font-family="'Foo, Inc'" is written as Foo\, Inc, which is valid CSS, but a second pass split it at the escaped comma into Foo\ (read as Foo + U+FFFD) and Inc. ListOf now treats a backslash as escaping the next character, in unquoted items and inside quotes (so 'Foo\', Inc' is one family too).

Closes #297

How Has This Been Tested?

Extended the font_family unit test with a round trip; it fails without the fix. All crate tests pass. Two passes over 'Foo, Inc', Foo\, Inc, Foo\2c Inc, a\\, b and 'Foo\', Inc' are now stable. On 157 real-world SVGs the output is identical to main with the none, safe and default presets.

Types of changes

Fixes

  • don't split lists at escaped separators

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

🤖 Generated with Claude Code

`font-family="'Foo, Inc'"` is written as `Foo\, Inc`, which is valid
CSS. Parsing that again split the list at the escaped comma, leaving
`Foo\` (read as `Foo` + U+FFFD) and `Inc`. `ListOf` now treats a
backslash as escaping the next character, both in unquoted items and
inside quotes, where an escaped quote no longer ends the item.

Closes noahbald#297

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noahbald
noahbald merged commit 7c17d39 into noahbald:main Sep 30, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

font-family with a comma in the name doesn't survive a second pass

2 participants