From 992f68dd430449ee842ea935091d01dd84c08b4c Mon Sep 17 00:00:00 2001 From: Nicholas Vinson Date: Mon, 7 Jan 2019 05:53:18 -0800 Subject: 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 --- wgetpaste | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 } -- cgit v1.2.3