georust / gpx

Rust read/write support for GPS Exchange Format (GPX)
https://crates.io/crates/gpx
MIT License
98 stars 44 forks source link

Parsing fails on extensions #89

Closed supersnellehenk closed 1 year ago

supersnellehenk commented 1 year ago

Hi,

I've got a GPX file coming from QMapShack with extensions that fails to parse, found here: https://pastebin.com/ETVKuhrZ. I'd expect to at least get a GPX result without extensions, since the library doesn't support them.

GPX library version: 0.9.0 Backtrace if interesting: https://pastebin.com/MKGNt68H

lnicola commented 1 year ago

Can you attach the file and paste the backtrace here? pastebin.com is throwing a fit.

supersnellehenk commented 1 year ago

A12 Veenendaal Wageningen.txt backtrace.txt Had to rename it, Github doesn't support GPX files ;) Thanks for taking a look @lnicola

lnicola commented 1 year ago

Looking at the tests (I've never seen a GPX until now :sweat_smile:), we support extensions under <metadata>, <trk> and <rte>, but yours are on the root. Perhaps we don't accept them in that position.

supersnellehenk commented 1 year ago

Looking at the tests (I've never seen a GPX until now 😅), we support extensions under <metadata>, <trk> and <rte>, but yours are on the root. Perhaps we don't accept them in that position.

I removed the extensions section on L475-481 from my file and it loads fine. Seems like the library should support this?

lnicola commented 1 year ago

Something like #90 should fix it, but I don't feel comfortable merging it without a review.

supersnellehenk commented 1 year ago

Something like #90 should fix it, but I don't feel comfortable merging it without a review.

Thanks for the PR, I'll await the release so we can use the files from QMapStack without manually editing them. <3

lnicola commented 1 year ago

You can use a git dependency on my branch in the meanwhile.

supersnellehenk commented 1 year ago

You can use a git dependency on my branch in the meanwhile.

Thanks, didn't know that existed (Rust noob). Works wonders!