1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

fix: 解决复制之前文件被删除报错的问题 (#3187)

Refs https://github.com/1Panel-dev/1Panel/issues/2961
This commit is contained in:
zhengkunwang 2023-12-05 16:00:10 +08:00 committed by GitHub
parent 1a400e7f81
commit 5f9073cb85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 4 deletions

View File

@ -251,8 +251,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, filepath.Clean(path)+"/") {
for _, oldPath := range m.OldPaths {
if !fo.Stat(oldPath) {
return buserr.WithName(constant.ErrFileNotFound, oldPath)
}
if oldPath == m.NewPath || strings.Contains(m.NewPath, filepath.Clean(oldPath)+"/") {
return buserr.New(constant.ErrMovePathFailed)
}
}

View File

@ -1091,6 +1091,8 @@ const message = {
fileRecycleBin: 'File Recycle Bin',
fileRecycleBinMsg: '{0} recycle bin',
wordWrap: 'Automatically wrap',
deleteHelper2:
'Are you sure you want to delete the selected file? The deletion operation cannot be rolled back',
},
ssh: {
autoStart: 'Auto Start',

View File

@ -1040,6 +1040,7 @@ const message = {
fileRecycleBin: '檔案回收站',
fileRecycleBinMsg: '{0}回收站',
wordWrap: '自動換行',
deleteHelper2: '確定刪除所選檔案 刪除操作不可回滾',
},
ssh: {
autoStart: '開機自啟',

View File

@ -1041,6 +1041,7 @@ const message = {
fileRecycleBin: '文件回收站',
fileRecycleBinMsg: '{0}回收站',
wordWrap: '自动换行',
deleteHelper2: '确定删除所选文件删除操作不可回滚',
},
ssh: {
autoStart: '开机自启',

View File

@ -3,9 +3,15 @@
<div>
<el-row>
<el-col :span="20" :offset="2">
<el-alert class="mt-2" :show-icon="true" type="warning" :closable="false">
<el-alert
class="mt-2"
:show-icon="true"
:type="recycleStatus === 'enable' ? 'warning' : 'error'"
:closable="false"
>
<div class="delete-warn">
<span>{{ $t('file.deleteHelper') }}</span>
<span v-if="recycleStatus === 'enable'">{{ $t('file.deleteHelper') }}</span>
<span v-else>{{ $t('file.deleteHelper2') }}</span>
</div>
</el-alert>
<div class="mt-4" v-if="recycleStatus === 'enable'">

View File

@ -85,6 +85,7 @@ const handleParams = () => {
rules[p.envKey] = [Rules.requiredInput];
}
}
form[p.envKey] = p.default;
}
emit('update:rules', rules);
updateParam();