Skip to content
Permalink
Browse files

Removed unnecessary '+' character URL decoding from search query

Manually replacing '+' character or "%20" by a space character in the
search query parameter was necessary in YaCy a long time ago to properly
decode application/x-www-form-urlencoded format (commit
9842fab in 2010).
Since the introduction of Jetty as the embedded HTTP server (commit
4b77733 in 2013), this is no more
necessary as Jetty internals already do this for us in
org.eclipse.jetty.util.UrlEncoded.decodeUtf8To().

So we can remove now this duplicated decoding as it prevents a proper
use of the '+' character in search requests, as reported in issue #216.
  • Loading branch information...
luccioman committed Aug 20, 2018
1 parent baa7154 commit b726b2b532207e5dc14e10dc792cfd1ca2ff9237
Showing with 2 additions and 2 deletions.
  1. +1 −1 htroot/suggest.java
  2. +1 −1 htroot/yacysearch.java
@@ -62,7 +62,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje

// get query
final String originalquerystring = (post == null) ? "" : post.get("query", post.get("q", ""));
final String querystring = originalquerystring.replace('+', ' ').replaceAll("%20", " ");
final String querystring = originalquerystring.trim();
final int timeout = (post == null) ? 300 : post.getInt("timeout", 300);
final int count = (post == null) ? 10 : Math.min(30, post.getInt("count", 20));

@@ -134,7 +134,7 @@ public static serverObjects respond(
final boolean focus = (post == null) ? true : post.get("focus", "1").equals("1");
// get query
final String originalquerystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim();
String querystring = originalquerystring.replace('+', ' ').trim();
String querystring = originalquerystring;
CacheStrategy snippetFetchStrategy = (post == null) ? null : CacheStrategy.parse(post.get("verify", sb.getConfig("search.verify", "")));

final servletProperties prop = new servletProperties();

0 comments on commit b726b2b

Please sign in to comment.
You can’t perform that action at this time.