mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-01 00:38:32 +01:00 
			
		
		
		
	Backport #34620 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		
							parent
							
								
									468d1919b5
								
							
						
					
					
						commit
						fb4e9f92f9
					
				| @ -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 { | ||||
| @ -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) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user