Browse code

[replication] BM-15050 Fix: quote parens correctly where returning a mailbox name

Thomas Cataldo authored on 15/07/2019 20:00:19
Showing 1 changed files
... ...
@@ -24,6 +24,8 @@ import org.slf4j.Logger;
24 24
 import org.slf4j.LoggerFactory;
25 25
 import org.vertx.java.core.json.JsonObject;
26 26
 
27
+import com.google.common.base.CharMatcher;
28
+
27 29
 import net.bluemind.backend.cyrus.replication.protocol.parsing.JsUtils;
28 30
 import net.bluemind.backend.cyrus.replication.server.Token;
29 31
 import net.bluemind.backend.mail.replica.api.MailboxAnnotation;
... ...
@@ -242,8 +244,10 @@ public class MailboxFolder {
242 244
 		return quotaRoot;
243 245
 	}
244 246
 
245
-	private String quoteIfNeeded(String s) {
246
-		if (s.contains(" ")) {
247
+	private static final CharMatcher quoteMatcher = CharMatcher.anyOf(" ()");
248
+
249
+	private static String quoteIfNeeded(String s) {
250
+		if (quoteMatcher.matchesAnyOf(s)) {
247 251
 			return "\"" + s + "\"";
248 252
 		} else {
249 253
 			return s;