summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Vinson <nvinson234@gmail.com>2019-01-07 05:53:18 -0800
committerRasmus Thomsen <oss@cogitri.dev>2020-07-07 18:30:03 +0200
commit992f68dd430449ee842ea935091d01dd84c08b4c (patch)
treeb86fcdf130ef8c70d2e415070b2ca22011ea185a
parentfd07ca397e8c1898a9378f4142418f59db0d467f (diff)
downloadwgetpaste-992f68dd430449ee842ea935091d01dd84c08b4c.tar.gz
Fallback location regex confusion fix
The fallback location regex can get confused if the input data contains URLs, and the confusion will cause wgetpaste to print the wrong link to the paste. Updated the regex so it finds the last URL that contains the service URL. wgetpaste can still get confused after this commit, but this commit should reduce the likelihood. Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
-rwxr-xr-xwgetpaste3
1 files changed, 2 insertions, 1 deletions
diff --git a/wgetpaste b/wgetpaste
index 99eb7f1..8df786a 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -562,7 +562,8 @@ geturl() {
sed -n -e "s|^.*Location: ${!location}|p" <<< "$*"
else
[[ needstdout = $1 ]] && return 1
- sed -n -e 's|^.*Location: \(https\{0,1\}://[^ ]*\).*$|\1|p' <<< "$*"
+ svc_url=URL_$SERVICE
+ sed -n -e "s|^.*Location: \\(${!svc_url}[^ ]*\\).*$|\\1|p" <<< "$*"
fi | tail -n1
}