aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2015-04-10 12:40:17 +0200
committerSamuel Tardieu <sam@rfc1149.net>2015-04-13 22:27:18 +0200
commit65e22a9c8022b0755ee7b7bfaf7df187bf222bb8 (patch)
tree5f544df9f4efb6226ee908334e5337ef8d8af3ef /main
parent515008f851f5ef9ae1b7288dc10ac1ac3782e0e5 (diff)
downloadcgeo-65e22a9c8022b0755ee7b7bfaf7df187bf222bb8.zip
cgeo-65e22a9c8022b0755ee7b7bfaf7df187bf222bb8.tar.gz
cgeo-65e22a9c8022b0755ee7b7bfaf7df187bf222bb8.tar.bz2
fix #4719: coord.info links with extra parameters not opening
Backport from master branch.
Diffstat (limited to 'main')
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConnector.java13
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;
}