summaryrefslogtreecommitdiffstats
path: root/lass
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-03-28 17:27:03 +0200
committerlassulus <lassulus@lassul.us>2022-03-28 17:27:03 +0200
commitb9e0a7ec71e0318a992ff2b275a6aaee3cef63bd (patch)
treeb955569df23dbc2295d297363287f45456690768 /lass
parentae9c0b12710b5361d0d45510eb401eebfc1b3fb0 (diff)
l fysiirc: strip newlines harder
Diffstat (limited to 'lass')
-rw-r--r--lass/2configs/fysiirc.nix18
1 files changed, 12 insertions, 6 deletions
diff --git a/lass/2configs/fysiirc.nix b/lass/2configs/fysiirc.nix
index f3c1d5b7c..e12eda42e 100644
--- a/lass/2configs/fysiirc.nix
+++ b/lass/2configs/fysiirc.nix
@@ -54,14 +54,20 @@ in {
name = "reaktor2-fysiweb-github";
};
script = ''. ${pkgs.writeDash "github-irc" ''
- set -efu
+ set -xefu
case "$Method $Request_URI" in
"POST /")
- payload=$(head -c "$req_content_length" \
- | sed 's/+/ /g;s/%\(..\)/\\x\1/g;' \
- | xargs -0 echo -e \
- )
- echo "$payload" | ${format-github-message}/bin/format-github-message
+ payload=$(head -c "$req_content_length")
+ echo "$payload" >&2
+ payload2=$payload
+ payload2=$(echo "$payload" | tr '\n' ' ' | tr -d '\r')
+ if [ "$payload" != "$payload2" ]; then
+ echo "payload has been mangled" >&2
+ else
+ echo "payload not mangled" >&2
+ fi
+ echo "$payload2" > /tmp/last_fysi_payload
+ echo "$payload2" | ${format-github-message}/bin/format-github-message
printf 'HTTP/1.1 200 OK\r\n'
printf 'Connection: close\r\n'
printf '\r\n'