Skip to content

Commit

Permalink
fixed: ImagePath: filenames containing blanks
Browse files Browse the repository at this point in the history
  • Loading branch information
RaiMan committed Mar 3, 2021
1 parent c6908f3 commit 285d928
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions API/src/main/java/org/sikuli/script/ImagePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,22 +221,21 @@ public boolean isHTTP() {
public String getPath() {
String path = "--invalid--";
if (isValid()) {
path = pathURL.toExternalForm();
if (isFile()) {
path = path.substring("file:".length());
} else if (isJar()) {
path = path.substring("jar:file:".length());
if (isHTTP()) {
return pathURL.toExternalForm();
} else {
File file = getFile();
if (file != null) {
return file.getPath();
}
}
}
return path;
}

public File getFile() {
if (isValid()) {
if (isFile() || isJar()) {
return new File(getPath());
}
return Commons.urlToFile(pathURL);
}
return null;
}
Expand Down

0 comments on commit 285d928

Please sign in to comment.