fix: close upload file before rename to avoid locking issues
This commit is contained in:
@@ -253,9 +253,9 @@ func httpPostUpload(w http.ResponseWriter, r *http.Request, ps httprouter.Params
|
|||||||
http.Error(w, "500 Internal Server Error", http.StatusInternalServerError)
|
http.Error(w, "500 Internal Server Error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer uploadFile.Close()
|
|
||||||
|
|
||||||
bytesWritten, err := io.Copy(uploadFile, part)
|
bytesWritten, err := io.Copy(uploadFile, part)
|
||||||
|
uploadFile.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = os.Remove(pathToFileInUploadFolder)
|
_ = os.Remove(pathToFileInUploadFolder)
|
||||||
http.Error(w, "500 Internal Server Error", http.StatusInternalServerError)
|
http.Error(w, "500 Internal Server Error", http.StatusInternalServerError)
|
||||||
|
Reference in New Issue
Block a user