Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Bugfix: httpdFileHandler.java did not handle filenames with encoded chars correctly See: http://www.yacy-forum.de/viewtopic.php?t=2265

thelicd4aeffea2eb
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java
index bc3414512..abdb4e1d1 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/httpdFileHandler.java
@@ -84,9 +84,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PushbackInputStream;
+import java.io.UnsupportedEncodingException;
import java.lang.ref.SoftReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
@@ -300,6 +302,14 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
return;
}
+ // url decoding of path
+ try {
+ path = URLDecoder.decode(path, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // This should never occur
+ assert(false) : "UnsupportedEncodingException: " + e.getMessage();
+ }
+
// check permission/granted access
String authorization = (String) requestHeader.get(httpHeader.AUTHORIZATION);
String adminAccountBase64MD5 = switchboard.getConfig("adminAccountBase64MD5", "");