fix: close upload file before rename to avoid locking issues

This commit is contained in:
2025-08-27 22:52:09 +02:00
parent 9fc8b370d0
commit 2b0597db0b

View File

@@ -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)