avoid quoting on basic strings

Shells don't need quoting for many basic characters, so make the
logic a bit smarter by omitting the quotes when the string consists
entirely of those "safe" characters.

Bug: Issue 10021
Change-Id: I8410572007d5700ce0fd7642e3322c0dc89e31cc
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/QuoteUtil.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/QuoteUtil.java
index e3c73f8..a08cbae 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/QuoteUtil.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/QuoteUtil.java
@@ -19,6 +19,11 @@
   private QuoteUtil() {}
 
   public static String quote(String string) {
-    return "\"" + string + "\"";
+    // Avoid quotes if the chars are entirely "safe".
+    if (string.matches("^[a-zA-Z0-9@_.:/-]+$")) {
+      return string;
+    } else {
+      return "\"" + string + "\"";
+    }
   }
 }