fix(decode): prevent false array header detection for unquoted keys c…#314
Open
rayriffy wants to merge 1 commit into
Open
fix(decode): prevent false array header detection for unquoted keys c…#314rayriffy wants to merge 1 commit into
rayriffy wants to merge 1 commit into
Conversation
…ontaining brackets and colons
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.
Linked Issue
Closes #
Description
This PR fixes a bug in the decoder where standard key-value pairs were mistakenly parsed as array headers.
Previously, if the parser encountered an unquoted key or value string containing both brackets and colons (e.g.,
display: "(Hello) [World] this (is:test)"), it would find the first[and assume it was parsing an array header. When it subsequently found the:later in the string, it would throw aSyntaxError: Unexpected content ... between bracket segment and colon.This fix updates
parseArrayHeaderLineto check if a colon (:) appears before the first bracket ([). If it does, the parser correctly identifies it as a key-value separator and aborts the array header parsing.To replicate:
returns following result
following the fix
Type of Change
Changes Made
parseArrayHeaderLine(packages/toon/src/decode/parser.ts) to ensure array header parsing is aborted if a key-value separator (:) appears before the first bracket ([).SPEC Compliance
Testing
Pre-submission Checklist
https://github.com/toon-format/specfor relevant sectionsBreaking Changes
Additional Context
This issue was specifically encountered when attempting to parse TOON documents with titles containing translated bracket tags and source parentheses (e.g., doujinshi/gallery metadata).