From e0942bae19182801d33696f2a009bdd0ed1eeba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Wed, 8 Dec 2021 23:14:04 -0300 Subject: [PATCH] Make webify follow redirects. - we also need to add --post302 so curl doesn't try to send a GET request for the redirect - move arguments into a variable to avoid repetition --- pastebin/templates/webify.txt.ep | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pastebin/templates/webify.txt.ep b/pastebin/templates/webify.txt.ep index 59a3a57..4bcc64d 100644 --- a/pastebin/templates/webify.txt.ep +++ b/pastebin/templates/webify.txt.ep @@ -19,13 +19,15 @@ done FILE=`basename "${@: -1}" | sed -e s/[^\]\[A-Za-z0-9._{}\(\)\-]/_/g` +CURL_ARGS="-s -L --post302 -F s=$PUBLIC -F o=$ONETIME" + if [ "${@: -1}" = '-' ]; then - curl -s -F "s=$PUBLIC" -F "o=$ONETIME" -F "p=@-;filename=stream" ${PASTE_HOST} + curl $CURL_ARGS -F "p=@-;filename=stream" ${PASTE_HOST} else if [ -d "${@: -1}" ]; then - tar -P -cf - "${@:-1}" | gzip | curl -s -F "s=$PUBLIC" -F "o=$ONETIME" -F "p=@-;filename=${FILE}.tar.gz" ${PASTE_HOST} + tar -P -cf - "${@:-1}" | gzip | curl $CURL_ARGS -F "p=@-;filename=${FILE}.tar.gz" ${PASTE_HOST} else - curl -s -F "s=$PUBLIC" -F "o=$ONETIME" -F "p=@${@: -1};filename=${FILE}" ${PASTE_HOST} + curl $CURL_ARGS -F "p=@${@: -1};filename=${FILE}" ${PASTE_HOST} fi fi