Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip invalid characters from beginning and end of pasted strings #1242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

retsoksirhc
Copy link

Had a few people run into this lately, someone copies a drawtools polygon from iitc, the pastes it into a hangout along with descriptive text before or after. Someone else copies the whole text block and pastes it into drawtools, which fails to render because of the extra text.

This PR adds an extra try/catch that activates only if parsing the pasted JSON fails. It strips out anything before and after the first and last [{ }]. What's left is probably what the user actually wanted to paste, and is parsed as JSON.

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