From 8974ebb86450941b8db50765f6ee52057eb6d34b Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 6 Jun 2022 16:02:54 +0200 Subject: l radio news: survive newline in input --- lass/2configs/radio/news.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lass/2configs/radio/news.nix') diff --git a/lass/2configs/radio/news.nix b/lass/2configs/radio/news.nix index 99b58511d..d66da813f 100644 --- a/lass/2configs/radio/news.nix +++ b/lass/2configs/radio/news.nix @@ -108,8 +108,8 @@ in ;; "POST /") payload=$(head -c "$req_content_length") - echo "$payload" | jq 'has("from") and has("to") and has("text")' >&2 - echo "$payload" | jq -c '{ from: (.from | fromdate | todate), to: (.to | fromdate | todate), text: .text }' >> "$HOME"/news + printf '%s' "$payload" | jq 'has("from") and has("to") and has("text")' >&2 + printf '%s' "$payload" | jq -c '{ from: .from, to: .to, text: .text, priority: (.priority // 0)}' >> "$HOME"/news printf 'HTTP/1.1 200 OK\r\n' printf 'Connection: close\r\n' printf '\r\n' -- cgit v1.2.3