From 24a74d6cbfc9ef06e47bf70baa96edd11456b45d Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Sat, 25 Dec 2021 12:42:39 +0300 Subject: [PATCH] fix: stop installation if the download is missing Fixes #54 --- tui/utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tui/utils.go b/tui/utils.go index 6547417..9d2ce8c 100644 --- a/tui/utils.go +++ b/tui/utils.go @@ -1,6 +1,7 @@ package tui import ( + "errors" "fmt" "io" "net/http" @@ -28,6 +29,9 @@ func DownloadFileWithProgressBar(url string, destination string, name string) er } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.New("The file asset cannot be accessed, possibly it was removed.") + } f, _ := os.OpenFile(destination, os.O_CREATE|os.O_WRONLY, 0755)