Changeset 12090 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r11847 r12090 47 47 if (b != null) 48 48 return b; 49 if (url.contains("#map")) { 49 if (url.contains("#map") || url.contains("/#")) { 50 50 // probably it's a URL following the new scheme? 51 51 return parseHashURLs(url); … … 95 95 */ 96 96 private static Bounds parseHashURLs(String url) { 97 int startIndex = url.indexOf( "#map=");97 int startIndex = url.indexOf('#'); 98 98 if (startIndex == -1) return null; 99 99 int endIndex = url.indexOf('&', startIndex); 100 100 if (endIndex == -1) endIndex = url.length(); 101 String coordPart = url.substring(startIndex+ 5, endIndex);101 String coordPart = url.substring(startIndex+(url.contains("#map=") ? "#map=".length() : "#".length()), endIndex); 102 102 String[] parts = coordPart.split("/"); 103 103 if (parts.length < 3) { -
trunk/test/unit/org/openstreetmap/josm/tools/OsmUrlToBoundsTest.java
r11329 r12090 73 73 new ParseTestItem("https://www.openstreetmap.org/#map", null), 74 74 new ParseTestItem("https://www.openstreetmap.org/#map=foo", null), 75 new ParseTestItem("https://www.openstreetmap.org/#map=fooz/foolat/foolon", null) 75 new ParseTestItem("https://www.openstreetmap.org/#map=fooz/foolat/foolon", null), 76 new ParseTestItem("http://tyrasd.github.io/latest-changes/#13/51.6891/10.2312", 77 OsmUrlToBounds.positionToBounds(51.6891, 10.2312, 13)) 76 78 }; 77 79
Note:
See TracChangeset
for help on using the changeset viewer.