🐛 Forbid MediaTrack to create a new folder with the same name

pull/548/head
微凉 2022-01-16 13:21:29 +08:00
parent 8245da485a
commit 07d6ca27db
2 changed files with 5 additions and 1 deletions

View File

@ -156,6 +156,10 @@ func (driver MediaTrack) Preview(path string, account *model.Account) (interface
}
func (driver MediaTrack) MakeDir(path string, account *model.Account) error {
_, err := driver.File(path, account)
if err != base.ErrPathNotFound {
return nil
}
parentFile, err := driver.File(utils.Dir(path), account)
if err != nil {
return err

View File

@ -46,7 +46,7 @@ func (h *Handler) stripPrefix(p string) (string, int, error) {
func isPathExist(ctx context.Context, fs *FileSystem, path string) (bool, FileInfo) {
file, err := fs.File(path)
if err != nil {
log.Debug(err)
log.Debug(path, err)
return false, nil
}
return true, file