Skip to content

Commit

Permalink
Update upload.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakura-Byte committed Jan 2, 2025
1 parent 6896c47 commit 4df67ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/115/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,11 @@ func (f *Fs) sampleUploadForm(ctx context.Context, in io.Reader, initResp *api.S
if err != nil {
return nil, fmt.Errorf("post form error: %w", err)
}
defer resp.Body.Close()
defer func() {
if cerr := resp.Body.Close(); cerr != nil && err == nil {
err = cerr
}
}()

respBody, err := io.ReadAll(resp.Body)
if err != nil {
Expand Down

0 comments on commit 4df67ea

Please sign in to comment.