Skip to content

Commit

Permalink
Fix typo in wikipedia tag format check
Browse files Browse the repository at this point in the history
  • Loading branch information
floscher committed Nov 24, 2019
1 parent 3105054 commit 527b3ef
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ push GitLab.com pages branch:
url: https://gitlab.com/JOSM/plugin/wikipedia/tree/pages/dist
script:
- |
base64 --decode "$SSH_PRIVATE_DEPLOY_KEY" > ~/.ssh/id_rsa
base64 -d "$SSH_PRIVATE_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
git clone --depth 1 --branch pages [email protected]:JOSM/plugin/wikipedia.git pages
- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public WikipediaValueFormat() {

@Override
public void check(OsmPrimitive p) {
Optional.ofNullable(p.get(OsmTagConstants.Key.WIKIDATA)).ifPresent(value -> {
checkFullUrl(p, OsmTagConstants.Key.WIKIDATA, value);
checkLanguageArticleFormat(p, OsmTagConstants.Key.WIKIDATA, value);
Optional.of(OsmTagConstants.Key.WIKIPEDIA).flatMap(k -> Optional.ofNullable(p.get(k)).map(v -> new Tag(k, v))).ifPresent(tag -> {
checkFullUrl(p, tag.getKey(), tag.getValue());
checkLanguageArticleFormat(p, tag.getKey(), tag.getValue());
// checkUrlDecode() is tested by core
});
p.keySet().stream().filter(Objects::nonNull).filter(it -> it.endsWith(":wikipedia")).collect(Collectors.toMap(it -> it, p::get)).forEach((key, value) -> {
Expand Down
27 changes: 27 additions & 0 deletions test/data/wikipedia-tag-value-format-validation.osm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' generator='JOSM'>
<node id='-1' action='modify' visible='true' lat='0.00000' lon='0.00000'>
<tag k='wikipedia' v='http://be-x-old.wikipedia.org/wiki/A' />
<tag k='name' v='A' />
</node>
<node id='-2' action='modify' visible='true' lat='0.00000' lon='0.00001'>
<tag k='wikipedia' v='https://be-x-old.wikipedia.org/wiki/B' />
<tag k='name' v='B' />
</node>
<node id='-3' action='modify' visible='true' lat='0.00000' lon='0.00002'>
<tag k='wikipedia' v='//be-x-old.wikipedia.org/wiki/C' />
<tag k='name' v='C' />
</node>
<node id='-4' action='modify' visible='true' lat='0.00000' lon='0.00003'>
<tag k='wikipedia' v='http://be-x-old.m.wikipedia.org/wiki/D' />
<tag k='name' v='D' />
</node>
<node id='-5' action='modify' visible='true' lat='0.00000' lon='0.00004'>
<tag k='wikipedia' v='https://be-x-old.m.wikipedia.org/wiki/E' />
<tag k='name' v='E' />
</node>
<node id='-6' action='modify' visible='true' lat='0.00000' lon='0.00005'>
<tag k='wikipedia' v='//be-x-old.m.wikipedia.org/wiki/F' />
<tag k='name' v='F' />
</node>
</osm>

0 comments on commit 527b3ef

Please sign in to comment.