jpsim / Yams

A Sweet and Swifty YAML parser.
https://jpsim.com/Yams
MIT License
1.11k stars 141 forks source link

Fix parsing of unquoted URLs #409

Closed czechboy0 closed 7 months ago

czechboy0 commented 7 months ago

Summary

I believe this fixes https://github.com/jpsim/Yams/issues/337, which I also just hit.

The problem is that trying to parse an int succeeded for the unquoted string http://example.com (parsed as the number 0), which caused issues when using an "AnyCodable" approach.

This PR makes the parsing stricter, so that a URL like above does not successfully parse as an int, and allows "AnyCodable" wrappers to only successfully parse the value as a string.

Test Plan

Added a unit test both for the positive and negative cases.