diff --git a/pkg/crawler/crawler.go b/pkg/crawler/crawler.go index 777784a..0182a5c 100644 --- a/pkg/crawler/crawler.go +++ b/pkg/crawler/crawler.go @@ -232,15 +232,16 @@ func (c *Crawler) parseMetadata(url string) (*Metadata, error) { func (c *Crawler) fetchSHA1(url string) ([]byte, error) { resp, err := c.http.Get(url) - // some projects don't have xxx.jar and xxx.jar.sha1 files - if resp.StatusCode == http.StatusNotFound { - return nil, nil // TODO add special error for this - } if err != nil { return nil, xerrors.Errorf("can't get sha1 from %s: %w", url, err) } defer resp.Body.Close() + // some projects don't have xxx.jar and xxx.jar.sha1 files + if resp.StatusCode == http.StatusNotFound { + return nil, nil // TODO add special error for this + } + sha1, err := io.ReadAll(resp.Body) if err != nil { return nil, xerrors.Errorf("can't read sha1 %s: %w", url, err)