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

Error with empty value + warning #2426

Merged
merged 2 commits into from
Jan 1, 2025
Merged

Error with empty value + warning #2426

merged 2 commits into from
Jan 1, 2025

Conversation

Famlam
Copy link
Collaborator

@Famlam Famlam commented Jan 1, 2025

Surprisingly this is the first time I'm encountering them, so I always thought they didn't exist, but the following taught me otherwise:

2024-12-31 10:39:59       File "/data/project/osmose/backend/plugins/TagFix_Maxspeed.py", line 99, in way
2024-12-31 10:39:59         maxspeed_tags = list(filter(lambda t: t.startswith('maxspeed') and tags[t][0] in "0123456789", tags))
2024-12-31 10:39:59                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-12-31 10:39:59       File "/data/project/osmose/backend/plugins/TagFix_Maxspeed.py", line 99, in <lambda>
2024-12-31 10:39:59         maxspeed_tags = list(filter(lambda t: t.startswith('maxspeed') and tags[t][0] in "0123456789", tags))
2024-12-31 10:39:59                                                                            ~~~~~~~^^^
2024-12-31 10:39:59     IndexError: string index out of range

Tags without value

Some examples from this extract: (this extract has 7 of them)

This PR fixes the issue and adds a warning against those that aren't warned against yet.

Also:

Happy new year!

@frodrigo
Copy link
Member

frodrigo commented Jan 1, 2025

As this issue my consern any plugin, maybe we should fix this as the parser level ?

@Famlam
Copy link
Collaborator Author

Famlam commented Jan 1, 2025

As this issue my consern any plugin, maybe we should fix this as the parser level ?

Not sure. I'm active for Osmose since 2020 and this is the first time I'm encountering it, so I guess it's pretty rare that analysers/plugins error on it. It was just a mistake of mine to not cover for this case. (I also guess there aren't too many plugins that get string indices without any prior check?)
Stripping those tags in the pre-parser would however prevent warnings being issued. So I would be in favor of just fixing any possible plugins that may error on it, and warning about this bad data.


p.s. I've reported it to Merkaartor too openstreetmap/merkaartor#310.

For AED maps I wasn't able to reproduce (couldn't even find an option to add opening_hours or images), it seems the last bad changeset was several months ago: https://www.openstreetmap.org/node/12171268601.

@frodrigo
Copy link
Member

frodrigo commented Jan 1, 2025

You are, right. I misunderstoot the issue.

@frodrigo frodrigo merged commit da20bb3 into dev Jan 1, 2025
6 checks passed
@Famlam Famlam deleted the famlam-emptyvalue branch January 1, 2025 20:47
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