fix(fs): fd must be closed after deleting, renaming

This commit is contained in:
hexxa 2021-09-18 23:07:54 +08:00 committed by Hexxa
parent ccfb9deb7e
commit dc80778255
3 changed files with 82 additions and 7 deletions

View file

@ -157,6 +157,7 @@ func (h *FileHandlers) Create(c *gin.Context) {
err = h.deps.FS().Create(tmpFilePath)
if err != nil {
fmt.Println("\nexist,", err, tmpFilePath)
if os.IsExist(err) {
// avoid adding file size more than once
err = h.deps.Users().SetUsed(userIDInt, false, req.FileSize)