Skip to content

Commit

Permalink
fix: stop installation if the download is missing
Browse files Browse the repository at this point in the history
Fixes #54
  • Loading branch information
srevinsaju committed Dec 25, 2021
1 parent 18a4689 commit 24a74d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tui/utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tui

import (
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 24a74d6

Please sign in to comment.