Skip to content

Commit

Permalink
Merge pull request #5 from signaux-faibles/fix/missing-file-handling
Browse files Browse the repository at this point in the history
-fix fermeture fichier source au bon moment quand le gzip est en erreur
  • Loading branch information
chrnin authored Aug 20, 2023
2 parents 19d1a10 + 9cb67c3 commit 811be03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions geosirene.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ func GeoSireneParser(ctx context.Context, r io.ReadCloser) chan GeoSirene {

func readGeoSirene(ctx context.Context, r io.ReadCloser, s chan GeoSirene) {
gzr, err := gzip.NewReader(r)
defer close(s)
defer r.Close()
if err != nil {
s <- GeoSirene{err: err}
return
}

defer close(s)
defer gzr.Close()
defer r.Close()

c := csv.NewReader(gzr)
if head, err := c.Read(); checkHeader(GeoSireneHeaders, head) && err != nil {
Expand Down

0 comments on commit 811be03

Please sign in to comment.