Skip to content

fix: trim leading/trailing whitespace on input to prevent load failure - #25

Open
rdwz wants to merge 2 commits into
jonasgeiler:mainfrom
rdwz:fix/paste-leading-whitespace-load-failed
Open

rdwz wants to merge 2 commits into
jonasgeiler:mainfrom
rdwz:fix/paste-leading-whitespace-load-failed

Conversation

@rdwz

@rdwz rdwz commented Sep 6, 2026

Copy link
Copy Markdown

Summary

  • Pasted SVG markup can include a stray leading newline (or other whitespace) before the <?xml ...?> declaration.
  • OXVG's parser rejects that as a misplaced XML declaration, surfacing a "Load failed" error to the user even though the SVG itself is valid.
  • Trim the input string before handing it to oxvg.wrapOriginal so this case loads successfully.

Test plan

  • Paste SVG markup with a leading blank line/whitespace before <?xml ...?> and confirm it loads instead of showing "Load failed".
  • Paste/load normal SVG markup (no leading whitespace) and confirm behavior is unchanged.

🤖 Generated with Claude Code

rdwz and others added 2 commits August 17, 2026 20:35
Pasted SVG markup can include a stray leading newline before the
<?xml ...?> declaration, which the parser rejects as a misplaced
declaration and causes "Load failed".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant