fix: ignore os.ErrClosed error on repeated FileStream close operations (#6762)

Also resolves the issue where S3 PutObject returns a 500 status code.
pull/6783/head
seiuneko 2024-07-14 20:59:24 +08:00 committed by GitHub
parent 736ba44031
commit 8278d3875b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -51,7 +51,11 @@ func (f *FileStream) IsForceStreamUpload() bool {
func (f *FileStream) Close() error {
var err1, err2 error
err1 = f.Closers.Close()
if errors.Is(err1, os.ErrClosed) {
err1 = nil
}
if f.tmpFile != nil {
err2 = os.RemoveAll(f.tmpFile.Name())
if err2 != nil {