From f9c767dc00778c7cabf1677a0f1700125dc22237 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Tue, 1 Jun 2021 20:26:10 -0400 Subject: [PATCH] scoop-cgi: make more bug resistant --- scoop-cgi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scoop-cgi b/scoop-cgi index b7531ec..8f56f3e 100755 --- a/scoop-cgi +++ b/scoop-cgi @@ -28,14 +28,16 @@ fi channel=$(grep -x "$channel" /etc/scoop-cgi/channels) if [ -z "$channel" ]; then echo "Status: 404" - echo "Content-type: text/plain\n" + printf "Content-type: text/plain\n\n" echo "404. Channel not logged." exit 0 fi time=$(echo "$PATH_INFO" | awk -F / '{print $3}' | xargs date -I -d) +today=$(date -I) +time=${time:-$today} db=$(cat /etc/scoop-cgi/database) -echo "Content-type: text/plain\n" -scoop -d "$db" -p "$channel" -D "${time:-now}" -F "%Y-%m-%d %H:%M:%S" \ +printf "Content-type: text/plain\n\n" +PAGER=/dev/tty scoop -d "$db" -p "$channel" -D "$time" -F "%Y-%m-%d %H:%M:%S" \ | awk '{$1=""; print substr($0, 2, length($0) - 1)}' -- 2.39.2