Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing asset ID detection does not work #28

Closed
vojtapol opened this issue Nov 15, 2021 · 2 comments
Closed

Missing asset ID detection does not work #28

vojtapol opened this issue Nov 15, 2021 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@vojtapol
Copy link
Contributor

vojtapol commented Nov 15, 2021

The script has an error on this line https://github.com/dsaltares/fetch-gh-release-asset/blob/master/fetch_github_asset.sh#L48

The jq command returns null when it can't find the asset which is then turned into 4 character string "null". Therefore the condition that should exit the script with 1 is never true because the string is not empty.

This can be verified on this example of empty assets array:

ASSET_ID=$(echo "{ \"assets\": [] }" | jq ".assets | map(select(.name == \"myasset.jar\"))[0].id")

if [[ -z "$ASSET_ID" ]]; then
  echo "Could not find asset ID"
  exit 1
fi

echo "Asset ID exists: $ASSET_ID"

exit 0

The script above will output Asset ID exists: null and exit with status 0.

@vojtapol vojtapol changed the title Missing facet ID detection does not work Missing asset ID detection does not work Nov 19, 2021
@dsaltares
Copy link
Owner

Thanks for reporting. I would love to receive a PR to fix this problem.

@dsaltares dsaltares added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Nov 22, 2021
vojtapol added a commit to vojtapol/fetch-gh-release-asset that referenced this issue Dec 28, 2021
@vojtapol
Copy link
Contributor Author

Thanks for reporting. I would love to receive a PR to fix this problem.

#30

dsaltares added a commit that referenced this issue Dec 30, 2021
#28 Fix missing asset ID detection
BSteffaniak pushed a commit to FlatLang/fetch-release-asset that referenced this issue Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants