From 4564541b3b3b1f525a2fe741bca952f8fa2916be Mon Sep 17 00:00:00 2001 From: luccioman Date: Thu, 4 May 2017 11:12:58 +0200 Subject: [PATCH] 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. --- htroot/Blacklist_p.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java index 76db8ef9b..bdbdc3bc0 100644 --- a/htroot/Blacklist_p.java +++ b/htroot/Blacklist_p.java @@ -38,6 +38,7 @@ import net.yacy.cora.protocol.RequestHeader; 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 class Blacklist_p { 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 class Blacklist_p { 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++; }