Skip to content

Commit

Permalink
Close file handles
Browse files Browse the repository at this point in the history
  • Loading branch information
whytheplatypus committed Oct 21, 2024
1 parent b6564e0 commit 898d7c5
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 898d7c5

Please sign in to comment.