mirror of https://github.com/1Panel-dev/1Panel
parent
b76d73dc13
commit
94ca229e71
|
@ -231,7 +231,7 @@ func (f *FileService) MvFile(m request.FileMove) error {
|
||||||
return buserr.New(constant.ErrPathNotFound)
|
return buserr.New(constant.ErrPathNotFound)
|
||||||
}
|
}
|
||||||
for _, path := range m.OldPaths {
|
for _, path := range m.OldPaths {
|
||||||
if path == m.NewPath || strings.Contains(m.NewPath, path) {
|
if path == m.NewPath || strings.Contains(m.NewPath, filepath.Clean(path)+"/") {
|
||||||
return buserr.New(constant.ErrMovePathFailed)
|
return buserr.New(constant.ErrMovePathFailed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ func (f FileOp) Cut(oldPaths []string, dst string) error {
|
||||||
for _, p := range oldPaths {
|
for _, p := range oldPaths {
|
||||||
base := filepath.Base(p)
|
base := filepath.Base(p)
|
||||||
dstPath := filepath.Join(dst, base)
|
dstPath := filepath.Join(dst, base)
|
||||||
if err := f.Fs.Rename(p, dstPath); err != nil {
|
if err := cmd.ExecCmd(fmt.Sprintf("mv %s %s", p, dstPath)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue