Skip to content

Commit

Permalink
fix: close res body metafates#205
Browse files Browse the repository at this point in the history
  • Loading branch information
Telmo committed Dec 6, 2024
1 parent 7232103 commit 9cf6e2b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions installer/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/metafates/mangal/filesystem"
"github.com/metafates/mangal/where"
"io"
"net/http"
"os"
"path/filepath"

"github.com/metafates/mangal/filesystem"
"github.com/metafates/mangal/util"
"github.com/metafates/mangal/where"
)

type Scraper struct {
Expand Down Expand Up @@ -42,6 +44,8 @@ func (s *Scraper) download() error {
return err
}

defer util.Ignore(res.Body.Close)

if res.StatusCode != http.StatusOK {
return fmt.Errorf("failed to get %s: %s", s.URL, res.Status)
}
Expand Down

0 comments on commit 9cf6e2b

Please sign in to comment.