feat: optimize file operation interface (#2757)

* feat: optimize file operation interface

* chore: fix typo

Co-authored-by: Noah Hsu <i@nn.ci>
This commit is contained in:
foxxorcat
2022-12-20 15:02:40 +08:00
committed by GitHub
parent e2bcca2fbd
commit 62a06fa0f9
13 changed files with 330 additions and 121 deletions

View File

@ -46,8 +46,6 @@ func moveFiles(ctx context.Context, src, dst string, overwrite bool) (status int
if err != nil {
return http.StatusInternalServerError, err
}
fs.ClearCache(srcDir)
fs.ClearCache(dstDir)
// TODO if there are no files copy, should return 204
return http.StatusCreated, nil
}
@ -60,7 +58,6 @@ func copyFiles(ctx context.Context, src, dst string, overwrite bool) (status int
if err != nil {
return http.StatusInternalServerError, err
}
fs.ClearCache(path.Dir(dst))
// TODO if there are no files copy, should return 204
return http.StatusCreated, nil
}

View File

@ -337,7 +337,6 @@ func (h *Handler) handlePut(w http.ResponseWriter, r *http.Request) (status int,
return http.StatusInternalServerError, err
}
w.Header().Set("ETag", etag)
fs.ClearCache(path.Dir(reqPath))
return http.StatusCreated, nil
}
@ -368,7 +367,6 @@ func (h *Handler) handleMkcol(w http.ResponseWriter, r *http.Request) (status in
}
return http.StatusMethodNotAllowed, err
}
fs.ClearCache(path.Dir(reqPath))
return http.StatusCreated, nil
}