Skip to content

Commit

Permalink
Close file handles (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
whytheplatypus authored Oct 23, 2024
1 parent 42e28d1 commit eea0185
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions upload-server/internal/delivery/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (fd *FileSource) GetMetadata(_ context.Context, tuid string) (map[string]st
}
return nil, err
}
defer f.Close()

b, err := io.ReadAll(f)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions upload-server/internal/loaders/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ func (l *FileConfigLoader) LoadConfig(_ context.Context, path string) ([]byte, e
if err != nil {
return nil, errors.Join(err, validation.ErrNotFound)
}
defer file.Close()
return io.ReadAll(file)
}

0 comments on commit eea0185

Please sign in to comment.