Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TaginfoAction.java
r16604 r16606 74 74 if (tagTable.getSelectedRowCount() == 1) { 75 75 final int row = tagTable.getSelectedRow(); 76 final String key = Utils.encodeUrl(tagKeySupplier.apply(row)).replaceAll("\\+", "%20");76 final String key = tagKeySupplier.apply(row); 77 77 Map<String, Integer> values = tagValuesSupplier.apply(row); 78 78 String value = values.size() == 1 ? values.keySet().iterator().next() : null; … … 112 112 public String getTaginfoUrlForTag(Tag tag) { 113 113 if (tag.getValue().isEmpty()) { 114 return taginfoUrl + "/keys/" + tag.getKey();114 return taginfoUrl + "/keys/" + encodeKeyValue(tag.getKey()); 115 115 } else { 116 return taginfoUrl + "/tags/" + tag.getKey() + '=' + Utils.encodeUrl(tag.getValue()).replaceAll("\\+", "%20");116 return taginfoUrl + "/tags/" + encodeKeyValue(tag.getKey()) + '=' + encodeKeyValue(tag.getValue()); 117 117 } 118 } 119 120 private static String encodeKeyValue(String string) { 121 return Utils.encodeUrl(string).replaceAll("\\+", "%20"); 118 122 } 119 123 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TaginfoActionTest.java
r16597 r16606 31 31 assertEquals("https://taginfo.openstreetmap.org/keys/railway", action.getTaginfoUrlForTag(new Tag("railway"))); 32 32 assertEquals("https://taginfo.openstreetmap.org/tags/railway=tram", action.getTaginfoUrlForTag(new Tag("railway", "tram"))); 33 assertEquals("https://taginfo.openstreetmap.org/tags/addr%3Acity=Bassum%3ACity", 34 action.getTaginfoUrlForTag(new Tag("addr:city", "Bassum:City"))); 33 35 assertEquals("https://taginfo.openstreetmap.org/relations/route", action.getTaginfoUrlForRelationType("route")); 34 36 } … … 48 50 */ 49 51 @Test 50 public void testTagHistoryUrls() {52 public void testTagHistoryUrls() throws Exception { 51 53 TaginfoAction action = new TaginfoAction(() -> null, () -> null).toTagHistoryAction(); 52 54 assertEquals("https://taghistory.raifer.tech/#***/railway/", action.getTaginfoUrlForTag(new Tag("railway"))); 53 55 assertEquals("https://taghistory.raifer.tech/#***/railway/tram", action.getTaginfoUrlForTag(new Tag("railway", "tram"))); 56 assertEquals("https://taghistory.raifer.tech/#***/addr:city/Bassum:City", 57 action.getTaginfoUrlForTag(new Tag("addr:city", "Bassum:City"))); 54 58 assertNull(action.getTaginfoUrlForRelationType("route")); 55 59 }
Note:
See TracChangeset
for help on using the changeset viewer.