Skip to content

Commit d57156e

Browse files
authored
chore: fix install.sh to point at releases API (#3510)
1 parent 7071411 commit d57156e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

install.sh

100644100755
+6-3
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,14 @@ http_copy() {
317317
github_release() {
318318
owner_repo=$1
319319
version=$2
320-
test -z "$version" && version="latest"
321-
giturl="https://github.com/${owner_repo}/releases/${version}"
320+
if [ -z "$version" ]; then
321+
giturl="https://api.github.com/repos/${owner_repo}/releases/latest"
322+
else
323+
giturl="https://api.github.com/repos/${owner_repo}/releases/tags/${version}"
324+
fi
322325
json=$(http_copy "$giturl" "Accept:application/json")
323326
test -z "$json" && return 1
324-
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
327+
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name": "//' | sed 's/".*//')
325328
test -z "$version" && return 1
326329
echo "$version"
327330
}

0 commit comments

Comments
 (0)