mirror of https://github.com/go-gitea/gitea.git
Ignore "Close" error when uploading container blob (#34620)
parent
6d0b24064a
commit
7a59f5a825
|
@ -403,12 +403,7 @@ func EndUploadBlob(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
doClose := true
|
defer uploader.Close()
|
||||||
defer func() {
|
|
||||||
if doClose {
|
|
||||||
uploader.Close()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if ctx.Req.Body != nil {
|
if ctx.Req.Body != nil {
|
||||||
if err := uploader.Append(ctx, ctx.Req.Body); err != nil {
|
if err := uploader.Append(ctx, ctx.Req.Body); err != nil {
|
||||||
|
@ -441,11 +436,10 @@ func EndUploadBlob(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := uploader.Close(); err != nil {
|
// There was a strange bug: the "Close" fails with error "close .../tmp/package-upload/....: file already closed"
|
||||||
apiError(ctx, http.StatusInternalServerError, err)
|
// AFAIK there should be no other "Close" call to the uploader between NewBlobUploader and this line.
|
||||||
return
|
// At least it's safe to call Close twice, so ignore the error.
|
||||||
}
|
_ = uploader.Close()
|
||||||
doClose = false
|
|
||||||
|
|
||||||
if err := container_service.RemoveBlobUploadByID(ctx, uploader.ID); err != nil {
|
if err := container_service.RemoveBlobUploadByID(ctx, uploader.ID); err != nil {
|
||||||
apiError(ctx, http.StatusInternalServerError, err)
|
apiError(ctx, http.StatusInternalServerError, err)
|
||||||
|
|
Loading…
Reference in New Issue