-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
remove upload: remove #13611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
It seems it's a bug. The file point isn't closed. |
Thanks for the answer, that is to say, this bug cannot be solved by modifying the configuration file? |
@aszswaz it would be nice if you can add some information about your gitea.
|
log:
os is win10 |
The bug is here.// UploadRepoFiles uploads files to the given repository
func UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRepoFileOptions) error {
...
for i, uploadInfo := range infos {
file, err := os.Open(uploadInfo.upload.LocalPath())
if err != nil {
return err
}
defer file.Close() // bug !!
...
}
...
return return models.DeleteUploads(uploads...) // the file handles are still not closed yet
} Please do like this:// UploadRepoFiles uploads files to the given repository
func UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRepoFileOptions) error {
for i, uploadInfo := range infos {
func() {
file, err := os.Open(uploadInfo.upload.LocalPath())
if err != nil {
return err
}
defer file.Close() // the file handle will be closed when the anonymous func return
...
}()
}
...
return return models.DeleteUploads(uploads...)
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When using the file upload function of gitea, an error occurred. How can I solve this? Going back to the warehouse page, you can see that the file upload was successful, but the upload cache file deletion failed.
The error message is:
remove upload: remove C:/Program Files/gitea/data/tmp/uploads/a/d/ad727a50-7d9d-4ae4-bcef-25f4e58fd2d6: The process cannot access the file because it is being used by another process.
The text was updated successfully, but these errors were encountered: