absolute paths on Windows appear to be valid URIs so we need explicitly exclude them (e.g. C:\path\to\script.groovy)

This commit is contained in:
Reinhard Pointner 2016-05-16 01:03:05 +08:00
parent 37bf803c86
commit d277315f39
1 changed files with 6 additions and 1 deletions

View File

@ -68,9 +68,14 @@ public enum ScriptSource {
@Override
public String accept(String input) {
// absolute paths on Windows appear to be valid URIs so we need explicitly exclude them (e.g. C:\path\to\script.groovy)
if (input.length() < 2 || input.charAt(1) == ':') {
return null;
}
try {
URI uri = new URI(input);
if (uri.isAbsolute() && uri.getScheme().length() > 1) {
if (uri.isAbsolute()) {
return getName(new File(uri.getPath()));
}
} catch (Exception e) {