avoid overwriting non-nil uploadReaderToChunks.uploadErr with nil value (#4560)

This commit is contained in:
柏杰 2023-06-11 14:15:27 +08:00 committed by GitHub
parent 5ee04d20fa
commit 68feffa4e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,9 +70,13 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
if err != nil || dataSize == 0 { if err != nil || dataSize == 0 {
bufPool.Put(bytesBuffer) bufPool.Put(bytesBuffer)
<-bytesBufferLimitChan <-bytesBufferLimitChan
if err != nil {
uploadErrLock.Lock() uploadErrLock.Lock()
if uploadErr == nil {
uploadErr = err uploadErr = err
}
uploadErrLock.Unlock() uploadErrLock.Unlock()
}
break break
} }
if chunkOffset == 0 && !isAppend { if chunkOffset == 0 && !isAppend {