Permalink
Browse files

Fixed blacklist Regex containing '+' characters rendering.

As reported on YaCy forum by shni
(http://forum.yacy-websuche.de/viewtopic.php?f=5&t=5970) when a
blacklist entry contained both '?' and '+' characters, the '+' chars
were wrongly decoded and rendered as spaces.
  • Loading branch information...
luccioman committed May 4, 2017
1 parent 0612a8f commit 4564541b3b3b1f525a2fe741bca952f8fa2916be
Showing with 5 additions and 2 deletions.
  1. +5 −2 htroot/Blacklist_p.java
@@ -38,6 +38,7 @@
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.data.ListManager;
import net.yacy.data.WorkTables;
import net.yacy.document.parser.html.CharacterCoding;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.repository.Blacklist;
import net.yacy.repository.Blacklist.BlacklistType;
@@ -332,7 +333,8 @@ public static serverObjects respond(final RequestHeader header, final serverObje
final String[] selectedEntries = post.getAll("selectedEntry.*");
if (selectedEntries != null && selectedEntries.length > 0 && blacklistToUse != null) {
for (int i = 0; i < selectedEntries.length; i++) {
prop.putHTML(DISABLED + EDIT + "editList_" + i + "_item", selectedEntries[i]);
/* We do not use here putHTML as we don't want '+' characters to be interpreted as application/x-www-form-urlencoded encoding */
prop.put(DISABLED + EDIT + "editList_" + i + "_item", CharacterCoding.unicode2html(selectedEntries[i], true));
prop.put(DISABLED + EDIT + "editList_" + i + "_count", i);
}
prop.putHTML(DISABLED + EDIT + "currentBlacklist", blacklistToUse);
@@ -384,7 +386,8 @@ public static serverObjects respond(final RequestHeader header, final serverObje
if (nextEntry.charAt(0) == '#') continue;
prop.put(DISABLED + EDIT + "Itemlist_" + entryCount + "_dark", dark ? "1" : "0");
dark = !dark;
prop.putHTML(DISABLED + EDIT + "Itemlist_" + entryCount + "_item", nextEntry);
/* We do not use here putHTML as we don't want '+' characters to be interpreted as application/x-www-form-urlencoded encoding */
prop.put(DISABLED + EDIT + "Itemlist_" + entryCount + "_item", CharacterCoding.unicode2html(nextEntry, true));
prop.put(DISABLED + EDIT + "Itemlist_" + entryCount + "_count", entryCount);
entryCount++;
}

0 comments on commit 4564541

Please sign in to comment.