Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
patch for bad windows file paths
Michael Peter Christene5b6424eeda7
diff --git a/source/net/yacy/cora/document/id/MultiProtocolURL.java b/source/net/yacy/cora/document/id/MultiProtocolURL.javaindex 18758b72e..c3c1924c2 100644--- a/source/net/yacy/cora/document/id/MultiProtocolURL.java+++ b/source/net/yacy/cora/document/id/MultiProtocolURL.java@@ -271,12 +271,16 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU// file://localhost/c:/WINDOWS/clock.avi// network file://hostname/path/to/the%20file.txt// local file:///c:/path/to/the%20file.txt- final String h = url.substring(p + 1);+ String h = url.substring(p + 1);this.host = null; // host is ignored on file: protocolif (h.startsWith("///")) { //absolute local file path// no host giventhis.path = h.substring(2); // "/path" or "/c:/path"} else if (h.startsWith("//")) { // "//host/path" or "//host/c:/path"+ if (h.charAt(3) == ':' && h.charAt(4) != '/' && h.charAt(4) != '\\') {+ // wrong windows path, after the doublepoint there should be a backslash+ h = h.substring(0, 4) + '\\' + h.substring(4);+ }int q = h.indexOf('/', 2);if (q < 0) {this.path = h.substring(2); // "path" or "c:/path"@@ -2317,7 +2321,8 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU*/public static void main(final String[] args) {final String[][] test = new String[][]{- new String[]{null, "file://Z:\\"},+ new String[]{null, "file://Z:admin\\home"}, // thats wrong but may appear+ new String[]{null, "file://Z:\\admin\\home"},new String[]{null, "https://www.example.com/shoe/?p=2&ps=75#t={%22san_NaviPaging%22:2}"}, // ugly strange pagination linknew String[]{null, "C:WINDOWS\\CMD0.EXE"},new String[]{null, "file://C:WINDOWS\\CMD0.EXE"},@@ -2388,7 +2393,7 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU((aURL != null) && (jURL != null) && (!(jURL.toString().equals(aURL.toNormalform(false)))))) {System.out.println("Difference for environment=" + environment + ", url=" + url + ":");System.out.println((jURL == null) ? "jURL rejected input" : "jURL=" + jURL.toString());- System.out.println((aURL == null) ? "aURL rejected input" : "aURL=" + aURL.toNormalform(false));+ System.out.println((aURL == null) ? "aURL rejected input" : "aURL=" + aURL.toNormalform(false) + "; host=" + aURL.getHost() + "; path=" + aURL.getPath() + "; file=" + aURL.getFile());}// check stability: the normalform of the normalform must be equal to the normalform