From 514d2ce0104f6a20e1222534d5f44949e8c0fe3e Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 23 Jun 2020 16:07:06 -0400 Subject: [PATCH] Fix escaping issues with spaces in server names Fixes #320 --- .../com/velocitypowered/proxy/config/AnnotatedConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java b/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java index 6d55bb1d4..ea2863555 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java @@ -212,8 +212,8 @@ public abstract class AnnotatedConfig { } protected static String escapeKeyIfNeeded(String key) { - if (key.contains(".") && !(key.indexOf('"') == 0 && key.lastIndexOf('"') == (key.length() - - 1))) { + if ((key.contains(".") || key.contains(" ")) + && !(key.indexOf('"') == 0 && key.lastIndexOf('"') == (key.length() - 1))) { return '"' + key + '"'; } return key;