diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6c1b456..d7168fb4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 git@gitlab.com:JOSM/plugin/wikipedia.git pages - | diff --git a/src/main/java/org/wikipedia/validator/WikipediaValueFormat.java b/src/main/java/org/wikipedia/validator/WikipediaValueFormat.java index 506c0bf6..d8209b04 100644 --- a/src/main/java/org/wikipedia/validator/WikipediaValueFormat.java +++ b/src/main/java/org/wikipedia/validator/WikipediaValueFormat.java @@ -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) -> { diff --git a/test/data/wikipedia-tag-value-format-validation.osm b/test/data/wikipedia-tag-value-format-validation.osm new file mode 100644 index 00000000..2ed361e4 --- /dev/null +++ b/test/data/wikipedia-tag-value-format-validation.osm @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +