diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2012-06-25 22:17:27 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2012-06-25 22:42:34 +0200 |
| commit | 169398924a0792ce57d5a4f116ae488f5befac8f (patch) | |
| tree | 8ebc4dc80c5932fd3e0fa10f0212bde7bebd01ba /main/src | |
| parent | 722e9f0d80b5565070599d11ff54f952e0feda55 (diff) | |
| download | cgeo-169398924a0792ce57d5a4f116ae488f5befac8f.zip cgeo-169398924a0792ce57d5a4f116ae488f5befac8f.tar.gz cgeo-169398924a0792ce57d5a4f116ae488f5befac8f.tar.bz2 | |
Fix #1824: properly unescape cache owner name
A name containing "&" was not properly unescaped. Also, when
displaying the owner name, do not treat it as HTML as it was sanitized
already.
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCParser.java | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index f5e2f52..d9b4e96 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -1370,9 +1370,9 @@ public class CacheDetailActivity extends AbstractActivity { if (StringUtils.isNotBlank(cache.getOwner()) || StringUtils.isNotBlank(cache.getOwnerReal())) { TextView ownerView = details.add(R.string.cache_owner, ""); if (StringUtils.isNotBlank(cache.getOwner())) { - ownerView.setText(Html.fromHtml(cache.getOwner()), TextView.BufferType.SPANNABLE); + ownerView.setText(cache.getOwner(), TextView.BufferType.SPANNABLE); } else { // OwnerReal guaranteed to be not blank based on above - ownerView.setText(Html.fromHtml(cache.getOwnerReal()), TextView.BufferType.SPANNABLE); + ownerView.setText(cache.getOwnerReal(), TextView.BufferType.SPANNABLE); } ownerView.setOnClickListener(new OwnerActionsClickListener()); } diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index 44b35b6..053c248 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -34,6 +34,7 @@ import ch.boye.httpclientandroidlib.HttpResponse; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.json.JSONArray; import org.json.JSONException; @@ -405,7 +406,7 @@ public abstract class GCParser { } // owner - cache.setOwner(Html.fromHtml(BaseUtils.getMatch(tableInside, GCConstants.PATTERN_OWNER, true, cache.getOwner())).toString()); + cache.setOwner(StringEscapeUtils.unescapeHtml4(BaseUtils.getMatch(tableInside, GCConstants.PATTERN_OWNER, true, cache.getOwner())).toString()); // hidden try { |
