aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2015-02-22 15:02:14 +0100
committerBananeweizen <bananeweizen@gmx.de>2015-02-22 15:02:14 +0100
commit53b5ee991350a5281775e6b651ab2bf589f2f01c (patch)
tree52fcae724a4d1d0eb92a03a69257c2f5798ad78b
parentbd313c736eb1da343834ea416254c1daed34364a (diff)
downloadcgeo-53b5ee991350a5281775e6b651ab2bf589f2f01c.zip
cgeo-53b5ee991350a5281775e6b651ab2bf589f2f01c.tar.gz
cgeo-53b5ee991350a5281775e6b651ab2bf589f2f01c.tar.bz2
fix geochecker links with encoded HTML
-rw-r--r--main/src/cgeo/geocaching/utils/CheckerUtils.java3
-rw-r--r--tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java1
2 files changed, 3 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/utils/CheckerUtils.java b/main/src/cgeo/geocaching/utils/CheckerUtils.java
index 956ebbf..39ef078 100644
--- a/main/src/cgeo/geocaching/utils/CheckerUtils.java
+++ b/main/src/cgeo/geocaching/utils/CheckerUtils.java
@@ -2,6 +2,7 @@ package cgeo.geocaching.utils;
import cgeo.geocaching.Geocache;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -25,7 +26,7 @@ public final class CheckerUtils {
final String url = matcher.group();
for (final String checker : CHECKERS) {
if (StringUtils.containsIgnoreCase(url, checker)) {
- return url;
+ return StringEscapeUtils.unescapeHtml4(url);
}
}
}
diff --git a/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java b/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java
index 70cf888..fa7c7e7 100644
--- a/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java
+++ b/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java
@@ -13,6 +13,7 @@ public class CheckerUtilsTest extends TestCase {
assertUrl("<p style=\"text-align:center;\"><a href=\"http://google.com/geo_inputchkcoord.php?gid=618932716cc7e68-c4bb-4f41-8bb1-3e0a3e374a1f\" target=\"_blank\"><img", null);
assertUrl("http://www.certitudes.org/certitude?wp=GC5MVX7", "http://www.certitudes.org/certitude?wp=GC5MVX7");
assertUrl("http://geochecker.com/index.php?code=e001928e3c2682ec2bae0f24b9d02cfb&action=check&wp=474350573454&name=47656f636865636b6572205465737420666f72204e33382030302e303030205737362030302e303030", "http://geochecker.com/index.php?code=e001928e3c2682ec2bae0f24b9d02cfb&action=check&wp=474350573454&name=47656f636865636b6572205465737420666f72204e33382030302e303030205737362030302e303030");
+ assertUrl("<p>Haarige Aussichten gibt es <a href=\"http://www.geochecker.com/index.php?code=cd52752a8649c5e385a624b5341176f9&amp;action=check&amp;wp=4743314a43384b&amp;name=4b61747a656e&amp;language=German\">hier</a>.</p></span>", "http://www.geochecker.com/index.php?code=cd52752a8649c5e385a624b5341176f9&action=check&wp=4743314a43384b&name=4b61747a656e&language=German");
}
private static void assertUrl(final String description, final String expected) {