From cf69b836acc3b81d73827fceb64cdd52dbe1b2f4 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 20 Dec 2022 23:31:53 +0900 Subject: [PATCH] Only trim CR and NF from the submitted expression So the trailing space in the following case is respected. curl -XPOST localhost:6266 -d "change-prompt:$(date)> " --- src/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.go b/src/server.go index f196edee..eaa314c9 100644 --- a/src/server.go +++ b/src/server.go @@ -97,7 +97,7 @@ func handleHttpRequest(conn net.Conn, channel chan []*action) string { } errorMessage := "" - actions := parseSingleActionList(strings.TrimSpace(string(body)), func(message string) { + actions := parseSingleActionList(strings.Trim(string(body), "\r\n"), func(message string) { errorMessage = message }) if len(errorMessage) > 0 {