Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix
  • Loading branch information
wxiaoguang committed Jun 6, 2025
commit 4c7ada15769f5ebf1ceaba3ff051f7db04e83abd
16 changes: 5 additions & 11 deletions routers/api/packages/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,7 @@ func EndUploadBlob(ctx *context.Context) {
}
return
}
doClose := true
defer func() {
if doClose {
uploader.Close()
}
}()
defer uploader.Close()

if ctx.Req.Body != nil {
if err := uploader.Append(ctx, ctx.Req.Body); err != nil {
Expand Down Expand Up @@ -441,11 +436,10 @@ func EndUploadBlob(ctx *context.Context) {
return
}

if err := uploader.Close(); err != nil {
apiError(ctx, http.StatusInternalServerError, err)
return
}
doClose = false
// There was a strange bug: the "Close" fails with error "close .../tmp/package-upload/....: file already closed"
// AFAIK there should be no other "Close" call to the uploader between NewBlobUploader and this line.
// At least it's safe to call Close twice, so ignore the error.
_ = uploader.Close()

if err := container_service.RemoveBlobUploadByID(ctx, uploader.ID); err != nil {
apiError(ctx, http.StatusInternalServerError, err)
Expand Down