[editor] Postal code validation insufficient #7789

Open
opened 2024-04-02 20:05:25 +00:00 by keunes · 6 comments
keunes commented 2024-04-02 20:05:25 +00:00 (Migrated from github.com)

Describe the issue
When editing or creating a node, there already is validation. However, in The Netherlands the verification is too lax: adding spaces or certain special characters (e.g. , or £) does not lead to an error.

Steps to reproduce

  1. Edit a node
  2. Change postcode from pattern 1234AB to 1234 AB

Expected behaviour
The app gives an error, as is already done in case additional numbers or letters are added:
Screenshot_20240402-215734.png

Screenshots
Screenshot_20240402-220212.png

System information:

  • Operating system and its version: Android 13
  • Organic Maps version: 2024.03.05-4-FDroid
  • Device Model: Fairphone 5

Additional context
I made a couple of changes via OM editor, which caused complaints from a Dutch OSM reviewer, as the postal code didn't comply with the standard.

**Describe the issue** When editing or creating a node, there already is validation. However, in The Netherlands the verification is too lax: adding spaces or certain special characters (e.g. `,` or `£`) does not lead to an error. **Steps to reproduce** 1. Edit a node 2. Change postcode from pattern `1234AB` to `1234 AB` **Expected behaviour** The app gives an error, as is already done in case additional numbers or letters are added: ![Screenshot_20240402-215734.png](/uploads/c816b099e1dfb913fb39a01fb0b76eee/1f13f00c-e609-4697-9b99-1ef9d321af82) **Screenshots** ![Screenshot_20240402-220212.png](/uploads/eb34ee831ba7c9343f887593cab9ced2/34845b72-3209-491b-aa09-ab4f5825ade4) **System information:** - Operating system and its version: Android 13 - Organic Maps version: 2024.03.05-4-FDroid - Device Model: Fairphone 5 **Additional context** I made a couple of changes via OM editor, which caused complaints from a Dutch OSM reviewer, as the postal code didn't comply with the standard.
Contributor

I took a look at the Dutch post codes. The official format is nnnn aa (n := number, a := letter) (Wikipedia), but OSM uses the format nnnnaa (without a space).

According to the list in Wikipedia no other country uses nnnn aa, so we could consider removing it from the list of allowed patterns is in postcodes_matcher.cpp. But we should double check the OSM data first.

It's strange that special characters like ?, !, ... are allowed.

Post code validation is also discussed in

I took a look at the Dutch post codes. The official format is `nnnn aa` (n := number, a := letter) ([Wikipedia](https://en.wikipedia.org/wiki/List_of_postal_codes)), but OSM uses the format `nnnnaa` (without a space). According to the list in Wikipedia no other country uses `nnnn aa`, so we could consider removing it from the list of allowed patterns is in [postcodes_matcher.cpp](https://github.com/organicmaps/organicmaps/blob/master/indexer/postcodes_matcher.cpp). But we should double check the OSM data first. It's strange that special characters like `?`, `!`, ... are allowed. _Post code validation is also discussed in #5116_
keunes commented 2024-12-07 22:47:24 +00:00 (Migrated from github.com)

I took a look at the Dutch post codes. The official format is nnnn aa (n := number, a := letter) (Wikipedia), but OSM uses the format nnnnaa (without a space).

Indeed. I wonder why, but for consistency it would make more sense to only allow nnnnaa

we could consider removing it from the list of allowed patterns is in postcodes_matcher.cpp

I don't understand, though: the file you linked to doesn't contain nnnnaa so how come that does work?

It's strange that special characters like ?, !, ... are allowed.

It seems that that list of allowed patterns isn't strictly checked – I guess it needs some changes in code to make it so (?)

> I took a look at the Dutch post codes. The official format is nnnn aa (n := number, a := letter) (Wikipedia), but OSM uses the format nnnnaa (without a space). Indeed. I wonder why, but for consistency it would make more sense to only allow `nnnnaa` > we could consider removing it from the list of allowed patterns is in postcodes_matcher.cpp I don't understand, though: the file you linked to doesn't contain `nnnnaa` so how come that _does_ work? > It's strange that special characters like ?, !, ... are allowed. It seems that that list of allowed patterns isn't strictly checked – I guess it needs some changes in code to make it so (?)
Contributor

I don't understand, though: the file you linked to doesn't contain nnnnaa so how come that does work?

nnnnaa is in the list (fourth row, second to last element)

> I don't understand, though: the file you linked to doesn't contain `nnnnaa` so how come that does work? `nnnnaa` is in the list (fourth row, second to last element)
Contributor

I checked the OSM data, nnnn aa is not used elsewhere in the word (there are about 100 usages in the Netherlands though, but that's insignificant).

So we can safely remove nnnn aa.

I checked the OSM data, `nnnn aa` is not used elsewhere in the word (there are about 100 usages in the Netherlands though, but that's insignificant). So we can safely remove `nnnn aa`.
Contributor

mentioned in merge request

mentioned in merge request !9853
Contributor

Update: Removing nnnn aa is not a good idea, because the list of post code patterns is also used in the search (see: )

Update: Removing `nnnn aa` is not a good idea, because the list of post code patterns is also used in the search (see: #9853)
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: organicmaps/organicmaps#7789
No description provided.