diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCConnector.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java index 2349392..b38d2e4 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java +++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java @@ -308,15 +308,16 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, @Override @Nullable public String getGeocodeFromUrl(@NonNull final String url) { + final String noQueryString = StringUtils.substringBefore(url, "?"); // coord.info URLs - String code = StringUtils.substringAfterLast(url, "coord.info/"); - if (code != null && canHandle(code)) { - return code; + final String afterCoord = StringUtils.substringAfterLast(noQueryString, "coord.info/"); + if (canHandle(afterCoord)) { + return afterCoord; } // expanded geocaching.com URLs - code = StringUtils.substringBetween(url, "/geocache/", "_"); - if (code != null && canHandle(code)) { - return code; + final String afterGeocache = StringUtils.substringBetween(noQueryString, "/geocache/", "_"); + if (afterGeocache != null && canHandle(afterGeocache)) { + return afterGeocache; } return null; } |