From 4783fef21c92f0930cae2eb671b32641680f5429 Mon Sep 17 00:00:00 2001 From: Suyash Kumar Date: Thu, 15 Jul 2021 18:42:45 -0400 Subject: [PATCH] If a valid release asset cannot be found, return a descriptive error. (#12) --- handlers/download.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/handlers/download.go b/handlers/download.go index 27a3767..e886eff 100644 --- a/handlers/download.go +++ b/handlers/download.go @@ -101,6 +101,10 @@ func Download(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { } } + if currentAsset == nil { + sendErrorWithCode(w, "Unable to find a release asset for your platform in the latest release.", 400) + } + log.Printf("User-Agent: %s", r.Header.Get("User-Agent")) log.Printf("Selected Asset: %s", currentAsset.DownloadURL) if !opts.Uncompress {