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:
parent
37bf803c86
commit
d277315f39
|
@ -68,9 +68,14 @@ public enum ScriptSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String accept(String input) {
|
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 {
|
try {
|
||||||
URI uri = new URI(input);
|
URI uri = new URI(input);
|
||||||
if (uri.isAbsolute() && uri.getScheme().length() > 1) {
|
if (uri.isAbsolute()) {
|
||||||
return getName(new File(uri.getPath()));
|
return getName(new File(uri.getPath()));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue