From 2b0597db0bcfa0dee3e1466506b43bfe829ad294 Mon Sep 17 00:00:00 2001 From: Andreas Schulte <0x0001f346@pm.me> Date: Wed, 27 Aug 2025 22:52:09 +0200 Subject: [PATCH] fix: close upload file before rename to avoid locking issues --- app/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/http.go b/app/http.go index dd7d7a4..8ab8a1c 100644 --- a/app/http.go +++ b/app/http.go @@ -253,9 +253,9 @@ func httpPostUpload(w http.ResponseWriter, r *http.Request, ps httprouter.Params http.Error(w, "500 Internal Server Error", http.StatusInternalServerError) return } - defer uploadFile.Close() bytesWritten, err := io.Copy(uploadFile, part) + uploadFile.Close() if err != nil { _ = os.Remove(pathToFileInUploadFolder) http.Error(w, "500 Internal Server Error", http.StatusInternalServerError)