From 0e87a99ab8ff595863523603be9c946f2ce139c7 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Fri, 10 Jul 2015 17:34:29 +0200 Subject: [PATCH] more fixes for special windows paths --- .../cora/document/id/MultiProtocolURL.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/net/yacy/cora/document/id/MultiProtocolURL.java b/source/net/yacy/cora/document/id/MultiProtocolURL.java index c3c1924c2..c8af66661 100644 --- a/source/net/yacy/cora/document/id/MultiProtocolURL.java +++ b/source/net/yacy/cora/document/id/MultiProtocolURL.java @@ -277,12 +277,12 @@ public class MultiProtocolURL implements Serializable, Comparable 4 && 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) { + if (q < 0 || h.length() > 3 && h.charAt(3) == ':') { this.path = h.substring(2); // "path" or "c:/path" } else { this.host = h.substring(2, q ); // TODO: handle "c:" ? @@ -2314,13 +2314,13 @@ public class MultiProtocolURL implements Serializable, Comparable 0) normalizedURL = normalizedURL.substring(p + 2); return splitpattern.split(normalizedURL.toLowerCase()); // word components of the url } -/* - public static void main(final String[] args) { - for (final String s: args) System.out.println(toTokens(s)); - } -*/ + public static void main(final String[] args) { final String[][] test = new String[][]{ + new String[]{null, "file://y:/"}, + new String[]{null, "file://y:/yacy"}, + new String[]{null, "file://y:/yacy/"}, + new String[]{null, "file://y:"}, 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 link @@ -2395,6 +2395,10 @@ public class MultiProtocolURL implements Serializable, Comparable