mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
fix: 限制复制和移动到自身
This commit is contained in:
parent
4992281e36
commit
2904ed0edc
@ -161,7 +161,6 @@ func (f FileService) GetContent(op request.FileOption) (response.FileInfo, error
|
||||
}
|
||||
|
||||
func (f FileService) SaveContent(edit request.FileEdit) error {
|
||||
|
||||
info, err := files.NewFileInfo(files.FileOption{
|
||||
Path: edit.Path,
|
||||
Expand: false,
|
||||
@ -190,7 +189,11 @@ func (f FileService) MvFile(m request.FileMove) error {
|
||||
if !fo.Stat(m.NewPath) {
|
||||
return buserr.New(constant.ErrPathNotFound)
|
||||
}
|
||||
|
||||
for _, path := range m.OldPaths {
|
||||
if path == m.NewPath || strings.Contains(m.NewPath, path) {
|
||||
return buserr.New(constant.ErrMovePathFailed)
|
||||
}
|
||||
}
|
||||
if m.Type == "cut" {
|
||||
return fo.Cut(m.OldPaths, m.NewPath)
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ var (
|
||||
//file
|
||||
var (
|
||||
ErrPathNotFound = "ErrPathNotFound"
|
||||
ErrMovePathFailed = "ErrMovePathFailed"
|
||||
)
|
||||
|
||||
//mysql
|
||||
|
@ -31,6 +31,7 @@ ErrUpdateBuWebsite: 'The application was updated successfully, but the modificat
|
||||
ErrFileCanNotRead: "File can not read"
|
||||
ErrFileToLarge: "file is too large"
|
||||
ErrPathNotFound: "Path is not found"
|
||||
ErrMovePathFailed: "The target path cannot contain the original path!"
|
||||
|
||||
#website
|
||||
ErrDomainIsExist: "Domain is already exist"
|
||||
|
@ -31,6 +31,7 @@ ErrUpdateBuWebsite: '应用更新成功,但是网站配置文件修改失败
|
||||
ErrFileCanNotRead: "此文件不支持预览"
|
||||
ErrFileToLarge: "文件超过10M,无法打开"
|
||||
ErrPathNotFound: "目录不存在"
|
||||
ErrMovePathFailed: "目标路径不能包含原路径!"
|
||||
|
||||
#website
|
||||
ErrDomainIsExist: "域名已存在"
|
||||
|
@ -100,6 +100,7 @@ const props = defineProps({
|
||||
const em = defineEmits(['choose']);
|
||||
|
||||
const checkFile = (row: any) => {
|
||||
console.log(row.path);
|
||||
rowName.value = row.name;
|
||||
em('choose', row.path);
|
||||
popoverVisible.value = false;
|
||||
|
@ -19,6 +19,7 @@
|
||||
label-width="100px"
|
||||
:rules="rules"
|
||||
v-loading="loading"
|
||||
@submit.enter.prevent
|
||||
>
|
||||
<el-form-item :label="$t('file.name')" prop="name">
|
||||
<el-input v-model="addForm.name" />
|
||||
|
@ -68,11 +68,11 @@
|
||||
@blur="search()"
|
||||
:placeholder="$t('file.search')"
|
||||
>
|
||||
<template #prepend>
|
||||
<!-- <template #prepend>
|
||||
<el-checkbox :disabled="req.path == '/'" v-model="req.containSub">
|
||||
{{ $t('file.sub') }}
|
||||
</el-checkbox>
|
||||
</template>
|
||||
</template> -->
|
||||
</el-input>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<br />
|
||||
<codemirror
|
||||
style="max-height: 600px; width: 100%"
|
||||
style="height: calc(100vh - 430px); width: 100%"
|
||||
:autofocus="true"
|
||||
:placeholder="$t('website.noLog')"
|
||||
:indent-with-tab="true"
|
||||
|
Loading…
x
Reference in New Issue
Block a user