修复unzip功能在用户数据目录和程序运行目录不同级时会找不到文件的问题
This commit is contained in:
parent
56c27c0090
commit
9fb103aee1
@ -303,7 +303,6 @@ func patchAction(ctx context.Context, action, src, dst string, d *data, fileCach
|
|||||||
if !d.user.Perm.Create {
|
if !d.user.Perm.Create {
|
||||||
return errors.ErrPermissionDenied
|
return errors.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileutils.Copy(d.user.Fs, src, dst)
|
return fileutils.Copy(d.user.Fs, src, dst)
|
||||||
case "rename":
|
case "rename":
|
||||||
if !d.user.Perm.Rename {
|
if !d.user.Perm.Rename {
|
||||||
@ -335,12 +334,8 @@ func patchAction(ctx context.Context, action, src, dst string, d *data, fileCach
|
|||||||
if !d.user.Perm.Unzip {
|
if !d.user.Perm.Unzip {
|
||||||
return errors.ErrPermissionDenied
|
return errors.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(src, "/") {
|
src = d.user.FullPath(src)
|
||||||
src = "." + src
|
dst = d.user.FullPath(dst)
|
||||||
}
|
|
||||||
if strings.HasPrefix(dst, "/") {
|
|
||||||
dst = "." + dst
|
|
||||||
}
|
|
||||||
return archiver.Unarchive(src, dst)
|
return archiver.Unarchive(src, dst)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported action %s: %w", action, errors.ErrInvalidRequestParams)
|
return fmt.Errorf("unsupported action %s: %w", action, errors.ErrInvalidRequestParams)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user