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 {
bufPool.Put(bytesBuffer)
<-bytesBufferLimitChan
uploadErrLock.Lock()
uploadErr = err
uploadErrLock.Unlock()
if err != nil {
uploadErrLock.Lock()
if uploadErr == nil {
uploadErr = err
}
uploadErrLock.Unlock()
}
break
}
if chunkOffset == 0 && !isAppend {