don't follow links like mailto:

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5909 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 16 years ago
parent e88a66bcae
commit 1351d903a1

@ -49,6 +49,7 @@ public class yacyURL implements Serializable {
private static final Pattern patternDot = Pattern.compile("\\.");
private static final Pattern patternSlash = Pattern.compile("/");
private static final Pattern patternAmp = Pattern.compile("&");
private static final Pattern patternMail = Pattern.compile("^[a-z]+:.*?");
// class variables
private String protocol, host, userInfo, path, quest, ref, hash;
@ -159,14 +160,12 @@ public class yacyURL implements Serializable {
public static yacyURL newURL(final String baseURL, final String relPath) throws MalformedURLException {
if ((baseURL == null) ||
(relPath.startsWith("mailto:")) ||
(relPath.startsWith("aim:")) ||
(relPath.startsWith("icq:")) ||
(relPath.startsWith("http://")) ||
(relPath.startsWith("https://")) ||
(relPath.startsWith("ftp://")) ||
(relPath.startsWith("file://")) ||
(relPath.startsWith("smb://"))) {
(relPath.startsWith("smb://")) /*||
relPath.contains(":") && patternMail.matcher(relPath.toLowerCase()).find()*/) {
return new yacyURL(relPath, null);
}
return new yacyURL(new yacyURL(baseURL, null), relPath);
@ -178,7 +177,8 @@ public class yacyURL implements Serializable {
(relPath.startsWith("https://")) ||
(relPath.startsWith("ftp://")) ||
(relPath.startsWith("file://")) ||
(relPath.startsWith("smb://"))) {
(relPath.startsWith("smb://")) /*||
relPath.contains(":") && patternMail.matcher(relPath.toLowerCase()).find()*/) {
return new yacyURL(relPath, null);
}
return new yacyURL(baseURL, relPath);
@ -207,7 +207,9 @@ public class yacyURL implements Serializable {
(relPath.startsWith("file://")) ||
(relPath.startsWith("smb://"))) {
this.path = baseURL.path;
} else if (relPath.startsWith("/")) {
} else if (relPath.contains(":") && patternMail.matcher(relPath.toLowerCase()).find()) { // discards also any unknown protocol from previous if
throw new MalformedURLException("relative path malformed: " + relPath);
} else if (relPath.startsWith("/")) {
this.path = relPath;
} else if (baseURL.path.endsWith("/")) {
if (relPath.startsWith("#") || relPath.startsWith("?")) {

Loading…
Cancel
Save