Fix github latest URL (#918)

This commit is contained in:
('o mo)y-˜ 2023-01-30 19:30:08 +09:00 committed by GitHub
parent e85e1a7234
commit 9432e676a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -280,8 +280,10 @@ http_copy() {
github_release() {
owner_repo=$1
version=$2
test -z "$version" && version="latest"
giturl="https://api.github.com/repos/${owner_repo}/releases/tags/${version}"
if [ -z "${version}" ]; then
giturl="https://api.github.com/repos/${owner_repo}/releases/latest"
fi
json=$(http_copy "$giturl" "Accept:application/json")
test -z "$json" && return 1
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name": *"//' | sed 's/".*//')