diff options
author | Nicholas Vinson <nvinson234@gmail.com> | 2019-01-07 05:53:18 -0800 |
---|---|---|
committer | Rasmus Thomsen <oss@cogitri.dev> | 2020-07-07 18:30:03 +0200 |
commit | 992f68dd430449ee842ea935091d01dd84c08b4c (patch) | |
tree | b86fcdf130ef8c70d2e415070b2ca22011ea185a | |
parent | fd07ca397e8c1898a9378f4142418f59db0d467f (diff) | |
download | wgetpaste-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-x | wgetpaste | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 } |