Skip to content

Commit

Permalink
fix(movie): Close reader to verify gzip checksum is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Apr 28, 2024
1 parent ae135b3 commit cd930bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/movie/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func FromFlags(flags *flag.FlagSet, path string) (Movie, error) {

movie := NewMovie()

var src io.Reader
var src io.ReadCloser
if path == "" {
// Use default embedded movie
path = movies.Default
Expand Down Expand Up @@ -91,6 +91,10 @@ func FromFlags(flags *flag.FlagSet, path string) (Movie, error) {
return movie, err
}

if err := src.Close(); err != nil {
return movie, err
}

log.Info().
Str("duration", movie.Duration().Round(time.Second).String()).
Str("took", time.Since(start).Round(time.Microsecond).String()).
Expand Down

0 comments on commit cd930bf

Please sign in to comment.