From 91af2427fa3535db2eb7ad5453eb3f3e533b54c5 Mon Sep 17 00:00:00 2001 From: Theile Date: Wed, 21 Sep 2022 11:58:56 +0200 Subject: [PATCH] Fix for #698 GitHub download links changed, fixed #698. --- fragments/functions.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fragments/functions.sh b/fragments/functions.sh index 85a7902..74045da 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -162,13 +162,15 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name fi if [ -n "$archiveName" ]; then - downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1) + #downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1) + downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1)" if [[ "$(echo $downloadURL | grep -ioE "https.*$archiveName")" == "" ]]; then printlog "Trying GitHub API for download URL." downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$archiveName\"/ { print \$4; exit }") fi else - downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1) + #downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1) + downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)" if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then printlog "Trying GitHub API for download URL." downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")