Merge pull request #814 from linuxserver/mod-scripts-grepswap

Use awk as grep -P isn't available with busybox
This commit is contained in:
Adam 2024-01-06 22:32:27 +00:00 committed by GitHub
commit c67e379aba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -248,9 +248,9 @@ get_auth_url() {
write_mod_debug "${auth_header}"
if [[ -n "${auth_header}" ]]; then
# Extract realm URL from www-authenticate header
realm_url=$(echo "$auth_header" | grep -oP 'realm="\K[^"]+')
service=$(echo "$auth_header" | grep -oP 'service="\K[^"]+')
scope=$(echo "$auth_header" | grep -oP 'scope="\K[^"]+')
realm_url=$(echo "$auth_header" | awk -F'[="]+' '/realm=/{print $2}')
service=$(echo "$auth_header" | awk -F'[="]+' '/service=/{print $4}')
scope=$(echo "$auth_header" | awk -F'[="]+' '/scope=/{print $6}')
echo "$realm_url?service=$service&scope=$scope"
else
exit 1