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) {
403403		}
404404		return 
405405	}
406- 	doClose  :=  true 
407- 	defer  func () {
408- 		if  doClose  {
409- 			uploader .Close ()
410- 		}
411- 	}()
406+ 	defer  uploader .Close ()
412407
413408	if  ctx .Req .Body  !=  nil  {
414409		if  err  :=  uploader .Append (ctx , ctx .Req .Body ); err  !=  nil  {
@@ -441,11 +436,10 @@ func EndUploadBlob(ctx *context.Context) {
441436		return 
442437	}
443438
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 ()
449443
450444	if  err  :=  container_service .RemoveBlobUploadByID (ctx , uploader .ID ); err  !=  nil  {
451445		apiError (ctx , http .StatusInternalServerError , err )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments