aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2015-09-27 10:45:21 +0200
committerBananeweizen <bananeweizen@gmx.de>2015-09-27 10:48:39 +0200
commitaaac91b850f4a7d999dcfc2970f447d8192c02fc (patch)
tree22d4ee4fcc8c7c5187523ab90efcc1e2b9072402
parentb1876d5bb11c5da2264dec949ff22270ddc2386e (diff)
downloadcgeo-aaac91b850f4a7d999dcfc2970f447d8192c02fc.zip
cgeo-aaac91b850f4a7d999dcfc2970f447d8192c02fc.tar.gz
cgeo-aaac91b850f4a7d999dcfc2970f447d8192c02fc.tar.bz2
fix #5200: spoiler description not parsed correctly
-rw-r--r--main/res/values/changelog_release.xml1
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConstants.java2
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java8
3 files changed, 6 insertions, 5 deletions
diff --git a/main/res/values/changelog_release.xml b/main/res/values/changelog_release.xml
index a18f3d9..1459664 100644
--- a/main/res/values/changelog_release.xml
+++ b/main/res/values/changelog_release.xml
@@ -4,6 +4,7 @@
<string name="changelog_release" translatable="false">\n
<b>Next release</b>\n
· Fix: Crash invoking Maps.me with waypoints without coordinates\n
+ · Fix: spoiler image descriptions were missing\n
\n
\n
<b>2015.09.23:</b>\n
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConstants.java b/main/src/cgeo/geocaching/connector/gc/GCConstants.java
index 0dabbe9..f822f4f 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConstants.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConstants.java
@@ -60,7 +60,7 @@ public final class GCConstants {
final static Pattern PATTERN_ATTRIBUTES = Pattern.compile("Attributes\\s*</h3>[^<]*<div class=\"WidgetBody\">((?:[^<]*<img src=\"[^\"]+\" alt=\"[^\"]+\"[^>]*>)+?)[^<]*<p");
/** Two groups ! */
final static Pattern PATTERN_ATTRIBUTESINSIDE = Pattern.compile("[^<]*<img src=\"([^\"]+)\" alt=\"([^\"]+?)\"");
- final static Pattern PATTERN_SPOILER_IMAGE = Pattern.compile("<a href=\"(http://img(?:cdn)?\\.geocaching\\.com[^.]+\\.(jpg|jpeg|png|gif))\"[^>]+>([^<]+)</a>(?:<br />([^<]+)<br /><br />)?");
+ final static Pattern PATTERN_SPOILER_IMAGE = Pattern.compile("<a href=\"(http://img(?:cdn)?\\.geocaching\\.com[^.]+\\.(?:jpg|jpeg|png|gif))\"[^>]+>" + "([^<]+)</a>" + "(?:\\s*<span[^>]*>([^<]+)</span>)?", Pattern.DOTALL);
final static Pattern PATTERN_INVENTORY = Pattern.compile("<span id=\"ctl00_ContentBody_uxTravelBugList_uxInventoryLabel\">\\W*Inventory[^<]*</span>[^<]*</h3>[^<]*<div class=\"WidgetBody\">([^<]*<ul>(([^<]*<li>[^<]*<a href=\"[^\"]+\"[^>]*>[^<]*<img src=\"[^\"]+\"[^>]*>[^<]*<span>[^<]+<\\/span>[^<]*<\\/a>[^<]*<\\/li>)+)[^<]*<\\/ul>)?");
final static Pattern PATTERN_INVENTORYINSIDE = Pattern.compile("[^<]*<li>[^<]*<a href=\"[a-z0-9\\-\\_\\.\\?\\/\\:\\@]*\\/track\\/details\\.aspx\\?guid=([0-9a-z\\-]+)[^\"]*\"[^>]*>[^<]*<img src=\"[^\"]+\"[^>]*>[^<]*<span>([^<]+)<\\/span>[^<]*<\\/a>[^<]*<\\/li>");
final static Pattern PATTERN_WATCHLIST = Pattern.compile(Pattern.quote("watchlist.aspx") + ".{1,50}" + Pattern.quote("action=rem"));
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index ad33a93..c0208dd 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -625,12 +625,12 @@ public final class GCParser {
final String url = matcherSpoilersInside.group(1).replace("/display", "");
String title = null;
- if (matcherSpoilersInside.group(3) != null) {
- title = matcherSpoilersInside.group(3);
+ if (matcherSpoilersInside.group(2) != null) {
+ title = matcherSpoilersInside.group(2);
}
String description = null;
- if (matcherSpoilersInside.group(4) != null) {
- description = matcherSpoilersInside.group(4);
+ if (matcherSpoilersInside.group(3) != null) {
+ description = matcherSpoilersInside.group(3);
}
if (title != null) {
cache.addSpoiler(new Image.Builder().setUrl(url).setTitle(title).setDescription(description).build());