Check other whitespace characters, e.g. tabs

This commit is contained in:
Muhammad Ikhsan 2017-10-17 16:29:40 +07:00
parent 99555a53f0
commit e441c96c85

View File

@ -2,8 +2,8 @@ package se.vidstige.jadb.managers;
public class Bash { public class Bash {
public static String quote(String s) { public static String quote(String s) {
// TODO: Should also check other whitespace // Check that s contains no whitespace
if (!s.contains(" ")) { if (s.matches("\\S+")) {
return s; return s;
} }
return "'" + s.replace("'", "'\\''") + "'"; return "'" + s.replace("'", "'\\''") + "'";