We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16b9788 commit 61ba260Copy full SHA for 61ba260
src/main/kotlin/com/coder/gateway/util/Escape.kt
@@ -12,8 +12,10 @@ fun escape(s: String): String {
12
if (s.contains("\n")) {
13
throw Exception("argument cannot contain newlines")
14
}
15
- if (s.contains(" ") || s.contains("\t")) {
16
- return "\"" + s.replace("\"", "\\\"") + "\""
+ if (s.contains(" ") || s.contains("\t") || s.contains("&")) {
+ // See https://github.com/coder/jetbrains-coder/issues/479
17
+ // Escape existing " and &
18
+ return "\"" + s.replace("\"", "\\\"").replace("&", "\\&") + "\""
19
20
return s.replace("\"", "\\\"")
21
0 commit comments