Skip to content

Commit

Permalink
fetchurl: only store 200 responses
Browse files Browse the repository at this point in the history
If I understand the docs properly, it should follow 30x redirects. We
don't want error responses, and things like 201 are also not interesting
to us.
  • Loading branch information
zimbatm committed May 17, 2022
1 parent 11cf0a6 commit c7a7659
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/cmd/cmd_fetchurl.go
Expand Up @@ -75,6 +75,11 @@ func cmdFetchURL(env Env, args []string, config *Config) (err error) {
}
defer resp.Body.Close()

// Abort if we don't get a 200 back
if resp.StatusCode != 200 {
return fmt.Errorf("Expected status code 200 but got %d", resp.StatusCode)
}

// While copying the content into the temporary location, also calculate the
// SRI hash.
w := sri.NewWriter(tmpfile, algo)
Expand Down

0 comments on commit c7a7659

Please sign in to comment.