From 2f946848cbf99a847358b9ca05f788a8a38be24c Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Mon, 12 Jun 2023 14:01:56 +0000 Subject: [PATCH] Telodendria Bot can now send messages again. The problem here is that some Matrix homeservers reject requests that don't have a Content-Length. http was not sending a Content-Length because it was reading from standard input. By reading from an actual file, we can actually easily get the size of the file to send as the Content-Length. --- tools/bin/tp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/bin/tp b/tools/bin/tp index 06b2295..fad2d87 100755 --- a/tools/bin/tp +++ b/tools/bin/tp @@ -30,7 +30,9 @@ matrix_send() { printf ',"format":"org.matrix.custom.html",' printf '"msgtype":"m.text"' printf '}' - ) | http -X PUT -d @- "$HOMESERVER/client/v3/rooms/$PATCHES_ROOM/send/m.room.message/$(date +%s)?access_token=$ACCESS_TOKEN" + ) > /tmp/tp-$$ + http -X PUT -d @/tmp/tp-$$ "$HOMESERVER/client/v3/rooms/$PATCHES_ROOM/send/m.room.message/$(date +%s)?access_token=$ACCESS_TOKEN" + rm /tmp/tp-$$ fi }