Skip to content

Commit d61cc47

Browse files
committed
fix: prevent self-destruction when updating from invalid branch
1 parent e426797 commit d61cc47

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ani-cli

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ version_info() {
105105
}
106106

107107
update_script() {
108-
update="$(curl -s -A "$agent" "https://raw.githubusercontent.com/pystardust/ani-cli/$branch/ani-cli")" || die "Connection error"
108+
printf "[branch:%s] Checking for Update..\n" "$branch"
109+
update="$(curl --fail-with-body -sL -A "$agent" "https://raw.githubusercontent.com/pystardust/ani-cli/$branch/ani-cli")" || die "[branch:$branch] Connection error: $update"
110+
printf '%s' "$update" | grep -q "^version_number" || die "[branch:$branch] Invalid Response."
109111
update="$(printf '%s\n' "$update" | diff -u "$0" -)"
110112
if [ -z "$update" ]; then
111113
printf "[branch:%s] Script is up to date :)\n" "$branch"

0 commit comments

Comments
 (0)