Modify ↓

Opened 5 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#24894 closed defect (fixed)

Mapillary keys longer than 15 characters are reported as errors by the validator, but there are also keys with 16 characters

Reported by: goodidea Owned by: wangi
Priority: normal Milestone:
Component: External rule Version:
Keywords: mapillary Cc:

Description

Mapillary keys longer than 15 characters are reported as errors by the validator, but there are keys with (at least?) 16 characters. I do not know what the maximum length is.

Example: ​https://www.mapillary.com/app/?pKey=1410083070176035 (tag: “mapillary=1410083070176035”).

The error message is: “mapillary tag should only contain image key (15 characters ciphers string)”

That should probably be adjusted.

JOSM/1.5 (19621 en)

Attachments (0)

Change History (7)

comment:1 by gaben, 4 weeks ago

Component: Core validator → Plugin mapillary
Owner: changed from team to taylor.smock

comment:2 by wangi, 4 weeks ago

Component: Plugin mapillary → Wiki content
Owner: changed from taylor.smock to wangi

This is not a bug in JOSM core or in the Mapillary plugin: the message comes from the wiki ruleset Rules/Pictures, which users install from the validator preferences. Neither resources/data/validator in core nor the plugin contain a check on mapillary values (the plugin only lists mapillary in ignoretags.cfg). So the fix is an edit of that wiki page, and I've reassigned the ticket to the wiki component.

The rule hard codes [0-9]{15}. Mapillary v4 image IDs are 64 bit integers and grow: a sample of the ~6000 most used mapillary values in taginfo gives

format share of uses
numeric, 15 digits 56 %
numeric, 16 digits 38 %
numeric, 17 digits 0.6 %
legacy 22 character alphanumeric key (pre 2021) 1.6 %
full mapillary.com URL 3 %
other 0.2 %

so nearly 40 % of the existing correct values are flagged. The plugin itself parses image IDs with Long.parseLong, i.e. up to 19 digits.

Proposed replacement for the three mapillary rules (also uses "image ID", which is the current Mapillary term, and gives the legacy keys their own, more helpful, warning instead of the generic error):

/* Mapillary image IDs are 64 bit integers, currently 15 to 17 digits long, see #24894. */

*[mapillary][mapillary!~/^[0-9]{15,19}$/][mapillary=~/pKey=[0-9]{15,19}/] {
    throwError: tr("mapillary tag should only contain image ID instead of full URL");
    fixAdd: concat("mapillary=", get(regexp_match(".*pKey=([0-9]{15,19}).*", tag("mapillary")),1));
}

*[mapillary][mapillary=~/^[A-Za-z0-9_-]{22}$/] {
    throwWarning: tr("mapillary tag contains a legacy image key, which Mapillary no longer resolves; replace it by the numeric image ID");
}

*[mapillary][mapillary!~/^[0-9]{15,19}$/][mapillary!~/pKey=[0-9]{15,19}/][mapillary!~/^[A-Za-z0-9_-]{22}$/] {
    throwError: tr("mapillary tag should only contain image ID (15 to 19 digits)");
}

Verified with JOSM's MapCSSTagChecker (r19624) against sample values: 1410083070176035 (the reporter's 16 digit ID), 15, 17 and 19 digit IDs pass; 1, abc and a 20 digit value give the error; https://www.mapillary.com/app/?pKey=1410083070176035&focus=photo gives the URL error and its fix sets mapillary=1410083070176035; a 22 character legacy key gives the warning. The lower bound of 15 is kept deliberately: no real ID shorter than 15 digits exists in the data and it still catches junk values like 1.

comment:3 by wangi, 4 weeks ago

Resolution: → fixed
Status: new → closed

Updated Rules/Pictures based on above.

comment:4 by gaben, 4 weeks ago

Great, that's why we ask for the detailed status report via report bug menu. Thanks for the fix!

Last edited 4 weeks ago by gaben (previous) (diff)

comment:5 by stoecker, 4 weeks ago

Note: You can add the tests directly to the rules with assertMatch() and assertNoMatch() :-)

comment:6 by wangi, 4 weeks ago

Never knew that - updated the wiki page with the ones i'd tested against!

comment:7 by skyper, 4 weeks ago

Component: Wiki content → External rule

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain wangi.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.