in maven-resolver-api/src/main/java/org/eclipse/aether/repository/RepositoryUriUtils.java [66:107]
private static String basedir(String url) {
String protocol = protocol(url);
String retValue;
if (!protocol.isEmpty()) {
retValue = url.substring(protocol.length() + 1);
} else {
retValue = url;
}
retValue = decode(retValue);
// special case: if omitted // on protocol, keep path as is
if (retValue.startsWith("//")) {
retValue = retValue.substring(2);
if (retValue.length() >= 2 && (retValue.charAt(1) == '|' || retValue.charAt(1) == ':')) {
// special case: if there is a windows drive letter, then keep the original return value
retValue = retValue.charAt(0) + ":" + retValue.substring(2);
} else {
// Now we expect the host
int index = retValue.indexOf("/");
if (index >= 0) {
retValue = retValue.substring(index + 1);
}
// special case: if there is a windows drive letter, then keep the original return value
if (retValue.length() >= 2 && (retValue.charAt(1) == '|' || retValue.charAt(1) == ':')) {
retValue = retValue.charAt(0) + ":" + retValue.substring(2);
} else if (index >= 0) {
// leading / was previously stripped
retValue = "/" + retValue;
}
}
}
// special case: if there is a windows drive letter using |, switch to :
if (retValue.length() >= 2 && retValue.charAt(1) == '|') {
retValue = retValue.charAt(0) + ":" + retValue.substring(2);
}
return retValue.trim();
}