Skip to content

Cause scalar string with colon to be quoted #380 - #382

Merged
Darrel (darrelmiller) merged 2 commits into
masterfrom
dm/fix380
Feb 11, 2019
Merged

Darrel (darrelmiller) merged 2 commits into
masterfrom
dm/fix380

Conversation

@darrelmiller

@darrelmiller Darrel (darrelmiller) commented Feb 2, 2019 •

Copy link
Copy Markdown
Member

A trailing colon in a string causes the YAML parser to think the scaler is a map key. This change ensures scalars with colons are quoted. Arguably, we could allow colons in the middle of strings as long as they are not followed by a space but, this change should be sufficient. Fixes #380

@PerthCharern

Copy link
Copy Markdown
Contributor

Darrel (@darrelmiller)

  • Though this works, this will add unnecessary single quotes for a frequent usage of URL (http://example.com) since it contains a colon in the scheme. Can we create a different list of "forbidden characters at end of string" and include colon in it instead? That would add the single quotes for this specific case while still keeping the URL case as normal.

  • Unit tests

@darrelmiller

Copy link
Copy Markdown
Member Author

PerthCharern That makes sense. I try and find time to work on that this week, although that might be a bit optimistic :-)

@darrelmiller

Copy link
Copy Markdown
Member Author

PerthCharern I updated this PR to check for colon as a terminal character. I have been unable to find other characters that cause a problem. I added a test for the scenario

@darrelmiller
Darrel (darrelmiller) merged commit e6f8c79 into master Feb 11, 2019
@darrelmiller
Darrel (darrelmiller) deleted the dm/fix380 branch February 11, 2019 19:56
@darrelmiller Darrel (darrelmiller) added this to the 1.1.3 milestone Apr 10, 2019
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.

2 participants