mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-23 18:49:21 +08:00
fix: 删除目录校验是否为禁止删除的目录 (#7031)
This commit is contained in:
parent
0b87025c52
commit
ec372dbb98
@ -211,9 +211,11 @@ func (f *FileService) Create(op request.FileCreate) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *FileService) Delete(op request.FileDelete) error {
|
func (f *FileService) Delete(op request.FileDelete) error {
|
||||||
excludeDir := global.CONF.System.DataDir
|
if op.IsDir {
|
||||||
if strings.Contains(op.Path, ".1panel_clash") || op.Path == excludeDir {
|
excludeDir := global.CONF.System.DataDir
|
||||||
return buserr.New(constant.ErrPathNotDelete)
|
if strings.Contains(op.Path, ".1panel_clash") || op.Path == excludeDir {
|
||||||
|
return buserr.New(constant.ErrPathNotDelete)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fo := files.NewFileOp()
|
fo := files.NewFileOp()
|
||||||
recycleBinStatus, _ := settingRepo.Get(settingRepo.WithByKey("FileRecycleBin"))
|
recycleBinStatus, _ := settingRepo.Get(settingRepo.WithByKey("FileRecycleBin"))
|
||||||
|
@ -89,11 +89,11 @@ const getStatus = async () => {
|
|||||||
const onConfirm = async () => {
|
const onConfirm = async () => {
|
||||||
const pros = [];
|
const pros = [];
|
||||||
for (const s of files.value) {
|
for (const s of files.value) {
|
||||||
if (s['path'].indexOf('.1panel_clash') > -1) {
|
|
||||||
MsgWarning(i18n.global.t('file.clashDeleteAlert'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (s['isDir']) {
|
if (s['isDir']) {
|
||||||
|
if (s['path'].indexOf('.1panel_clash') > -1) {
|
||||||
|
MsgWarning(i18n.global.t('file.clashDeleteAlert'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
const pathRes = await loadBaseDir();
|
const pathRes = await loadBaseDir();
|
||||||
if (s['path'] === pathRes.data) {
|
if (s['path'] === pathRes.data) {
|
||||||
MsgWarning(i18n.global.t('file.panelInstallDir'));
|
MsgWarning(i18n.global.t('file.panelInstallDir'));
|
||||||
|
Loading…
Reference in New Issue
Block a user