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

allow empty fields: "desc", "cmt", "description", "keywords", "src" #25

Merged
merged 4 commits into from
Mar 7, 2020
Merged

allow empty fields: "desc", "cmt", "description", "keywords", "src" #25

merged 4 commits into from
Mar 7, 2020

Conversation

dhontecillas
Copy link
Contributor

Found an issue with a .gpx file, where the "cmt" and the "desc" fields for the waypoints were empty. It looks to me that is not a problem to have an empty comment or description. Looking at the spec, it just states that those fields must be strings (https://www.topografix.com/GPX/1/1/#type_wptType) , but there is no specification about if the have to be at least of length > 0.

My approach to fix it has been to modify the string::consume function, that accepts and additional bool parameter allow_empty. Another way would be to create a different function (consume_opt for example), that calls the original consume and checks the error. The problem with this approach is that I would need to check for the type of error returned from the string::consume function, and only if is the "no content inside string" one, return the empty string.

Copy link
Member

@frewsxcv frewsxcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@frewsxcv frewsxcv merged commit 5fda782 into georust:master Mar 7, 2020
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.

None yet

2 participants