File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
routers/api/packages/container Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -403,12 +403,7 @@ func EndUploadBlob(ctx *context.Context) {
403
403
}
404
404
return
405
405
}
406
- doClose := true
407
- defer func () {
408
- if doClose {
409
- uploader .Close ()
410
- }
411
- }()
406
+ defer uploader .Close ()
412
407
413
408
if ctx .Req .Body != nil {
414
409
if err := uploader .Append (ctx , ctx .Req .Body ); err != nil {
@@ -441,11 +436,10 @@ func EndUploadBlob(ctx *context.Context) {
441
436
return
442
437
}
443
438
444
- if err := uploader .Close (); err != nil {
445
- apiError (ctx , http .StatusInternalServerError , err )
446
- return
447
- }
448
- doClose = false
439
+ // There was a strange bug: the "Close" fails with error "close .../tmp/package-upload/....: file already closed"
440
+ // AFAIK there should be no other "Close" call to the uploader between NewBlobUploader and this line.
441
+ // At least it's safe to call Close twice, so ignore the error.
442
+ _ = uploader .Close ()
449
443
450
444
if err := container_service .RemoveBlobUploadByID (ctx , uploader .ID ); err != nil {
451
445
apiError (ctx , http .StatusInternalServerError , err )
You can’t perform that action at this time.
0 commit comments