From 3becfad4f7caf1bfd1f2db1dcb56fd310c7b7c4f Mon Sep 17 00:00:00 2001 From: Nezumi-2711 Date: Sat, 17 Jan 2026 13:03:35 +0700 Subject: [PATCH] fix: resolve the utils logic --- utils.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/utils.sh b/utils.sh index 6291ffe..9c8eca3 100755 --- a/utils.sh +++ b/utils.sh @@ -100,20 +100,13 @@ get_rv_prebuilts() { if [ "$ver" = "dev" ]; then resp=$(jq -r '.[0]' <<<"$resp"); fi tag_name=$(jq -r '.tag_name' <<<"$resp") # Filter assets by extension and handle multiple matches + # Use jq array syntax to get first match as a complete JSON object if [ "$ver" = "dev" ]; then # For dev version, prefer the one with "dev" in the name - asset=$(jq -e -r ".assets[] | select(.name | endswith(\"$ext\") and contains(\"dev\"))" <<<"$resp" | head -1) - # If no dev asset found, take any matching asset - if [ -z "$asset" ]; then - asset=$(jq -e -r ".assets[] | select(.name | endswith(\"$ext\"))" <<<"$resp" | head -1) || return 1 - fi + asset=$(jq -e -r "[.assets[] | select(.name | endswith(\"$ext\") and contains(\"dev\"))][0] // [.assets[] | select(.name | endswith(\"$ext\"))][0]" <<<"$resp") || return 1 else # For non-dev versions, exclude dev builds and take the first match - asset=$(jq -e -r ".assets[] | select(.name | endswith(\"$ext\") and (contains(\"dev\") | not))" <<<"$resp" | head -1) - # If no non-dev asset found, take any matching asset - if [ -z "$asset" ]; then - asset=$(jq -e -r ".assets[] | select(.name | endswith(\"$ext\"))" <<<"$resp" | head -1) || return 1 - fi + asset=$(jq -e -r "[.assets[] | select(.name | endswith(\"$ext\") and (contains(\"dev\") | not))][0] // [.assets[] | select(.name | endswith(\"$ext\"))][0]" <<<"$resp") || return 1 fi url=$(jq -r .url <<<"$asset") name=$(jq -r .name <<<"$asset")