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

Check for GPX root node on parse #276

Closed
derinwalters opened this issue Dec 25, 2023 · 1 comment
Closed

Check for GPX root node on parse #276

derinwalters opened this issue Dec 25, 2023 · 1 comment

Comments

@derinwalters
Copy link

Looks like the raising of GPXException inside the parse method uses a message about requiring a gpx root node, but it doesn't actually check for one. Instead, it is only checking for the existence of root. What this means in practice is that no errors are thrown if I load a different format's valid XML, for example a KML file.

I would like to propose that this line in parser.py be changed from:

        if root is None:
            raise mod_gpx.GPXException('Document must have a `gpx` root node.')

to:

        if root is None or root.tag.lower() != 'gpx':
            raise mod_gpx.GPXException('Document must have a `gpx` root node.')
tkrajina added a commit that referenced this issue Jan 7, 2024
@tkrajina
Copy link
Owner

tkrajina commented Jan 7, 2024

Yes, you're right. Fixed it now (in dev). Thanks!

@tkrajina tkrajina closed this as completed Jan 7, 2024
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

No branches or pull requests

2 participants