summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2018-01-21 14:15:15 +0100
committerYorhel <git@yorhel.nl>2018-01-21 14:17:10 +0100
commite636df2114cd18a28424a11345c56cbef221514b (patch)
treed6bcd838ea024af4f21f2e22c038d74d8b3a89c9
parent31b596a326cc7c2333b872b95cef6b77364085a5 (diff)
bpaste.sh: Fix handling of relative redirects
-rw-r--r--bpaste.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/bpaste.sh b/bpaste.sh
index 881ff6b..a704de5 100644
--- a/bpaste.sh
+++ b/bpaste.sh
@@ -14,6 +14,9 @@
# projects@yorhel.nl
# License: MIT
#
+# 0.6 - 2018-01-21
+# - Display absolute URL even when the server gives a relative redirect
+#
# 0.5 - 2016-07-02
# - Fix inversion of the -c option
#
@@ -40,7 +43,7 @@ SYNTAX=nosyntax
FILE=-
WRAP=0
CLICK=1
-VERSION=0.5
+VERSION=0.6
showhelp() {
@@ -86,4 +89,5 @@ PASS=
curl -si -A "bpaste $VERSION" -F "f=<$TMPFILE" -F "s=$SYNTAX" -F "w=$WRAP" -F "c=$CLICK" -F "p=$PASS" $HOST\
| grep 'Location: '\
- | sed 's/^Location: //'
+ | sed 's/^Location: http/http/'\
+ | sed "s#^Location: /#$HOST#"