Skip to content

Commit

Permalink
fixed shell escaping by just using single quotes, see GH issue #269
Browse files Browse the repository at this point in the history
  • Loading branch information
wolpi committed Jul 23, 2022
1 parent 9b38a0d commit 34b9d48
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions primitiveFTPd/src/org/primftpd/filesystem/RootFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,7 @@ private void logDdErrorStream(Process proc) throws IOException {

protected static String escapePath(String path) {
if (path != null) {
if (path.indexOf(' ') >= 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i<path.length(); i++) {
if (path.charAt(i) == ' ' && i > 0 && path.charAt(i-1) != '\\') {
sb.append("\\ ");
} else {
sb.append(path.charAt(i));
}
}
path = sb.toString();
}
path = "'" + path + "'";
}
return path;
}
Expand Down

0 comments on commit 34b9d48

Please sign in to comment.