mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 23:21:00 +08:00
fix: clean dir
This commit is contained in:
@@ -26,7 +26,10 @@ func NewWebdavStorage(url, user, password string) (*WebdavStorage, error) {
|
||||
|
||||
func (w *WebdavStorage) Move(local, remote string) error {
|
||||
baseLocal := filepath.Base(local)
|
||||
remoteBase := filepath.Join(remote, baseLocal)
|
||||
|
||||
log.Infof("remove all content in %s", remoteBase)
|
||||
w.fs.RemoveAll(remoteBase)
|
||||
err := filepath.Walk(local, func(path string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "read file %v", path)
|
||||
@@ -36,7 +39,7 @@ func (w *WebdavStorage) Move(local, remote string) error {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "path relation")
|
||||
}
|
||||
remoteName := filepath.Join(remote, baseLocal, rel)
|
||||
remoteName := filepath.Join(remoteBase, rel)
|
||||
|
||||
if info.IsDir() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user