Skip to content

Commit 4b540a2

Browse files
committed
feat: skip creating an existing folder
1 parent 8a62d55 commit 4b540a2

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/mediatrack/driver.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ func (driver MediaTrack) Preview(path string, account *model.Account) (interface
158158
}
159159

160160
func (driver MediaTrack) MakeDir(path string, account *model.Account) error {
161-
_, err := driver.File(path, account)
162-
if err != base.ErrPathNotFound {
163-
return nil
164-
}
165161
parentFile, err := driver.File(utils.Dir(path), account)
166162
if err != nil {
167163
return err

drivers/operate/operate.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ func File(driver base.Driver, account *model.Account, path string) (*model.File,
2929

3030
func MakeDir(driver base.Driver, account *model.Account, path string, clearCache bool) error {
3131
log.Debugf("mkdir: %s", path)
32-
err := driver.MakeDir(path, account)
32+
_, err := Files(driver, account, path)
33+
if err != base.ErrPathNotFound {
34+
return nil
35+
}
36+
err = driver.MakeDir(path, account)
3337
if err == nil && clearCache {
3438
_ = base.DeleteCache(utils.Dir(path), account)
3539
}

0 commit comments

Comments
 (0)