diff --git a/agent/app/api/v2/file.go b/agent/app/api/v2/file.go index 5b0b99ef7..0e4b1c170 100644 --- a/agent/app/api/v2/file.go +++ b/agent/app/api/v2/file.go @@ -768,8 +768,12 @@ func (b *BaseApi) ProcessKeys(c *gin.Context) { continue } var process files.Process - if err := json.Unmarshal([]byte(value), &process); err == nil && process.Percent != 100 { - res.Keys = append(res.Keys, key) + if err := json.Unmarshal([]byte(value), &process); err != nil { + continue + } + res.Keys = append(res.Keys, key) + if process.Percent == 100 { + global.CACHE.Del(key) } } helper.SuccessWithData(c, res) diff --git a/agent/utils/files/file_op.go b/agent/utils/files/file_op.go index 44f26644c..5cd7c68ae 100644 --- a/agent/utils/files/file_op.go +++ b/agent/utils/files/file_op.go @@ -7,6 +7,7 @@ import ( "crypto/tls" "encoding/json" "fmt" + "github.com/1Panel-dev/1Panel/agent/buserr" "io" "io/fs" "net/http" @@ -394,10 +395,7 @@ func (f FileOp) CopyAndReName(src, dst, name string, cover bool) error { if dst = path.Clean("/" + dst); dst == "" { return os.ErrNotExist } - if src == "/" || dst == "/" { - return os.ErrInvalid - } - if dst == src { + if src == "/" || dst == src { return os.ErrInvalid } @@ -406,6 +404,12 @@ func (f FileOp) CopyAndReName(src, dst, name string, cover bool) error { return err } + if name != "" && !cover { + if f.Stat(filepath.Join(dst, name)) { + return buserr.New("ErrFileIsExist") + } + } + if srcInfo.IsDir() { dstPath := dst if name != "" && !cover { diff --git a/frontend/src/views/host/file-management/code-editor/index.vue b/frontend/src/views/host/file-management/code-editor/index.vue index 5abc2ce1d..6575215de 100644 --- a/frontend/src/views/host/file-management/code-editor/index.vue +++ b/frontend/src/views/host/file-management/code-editor/index.vue @@ -437,6 +437,7 @@ const initEditor = () => { minimap: { enabled: config.minimap, }, + lineNumbersMinChars: 6, }); if (editor.getModel().getValue() === '') { let defaultContent = '\n\n\n\n'; diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index daad858a2..9c8d13b0b 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -763,10 +763,14 @@ const openProcess = () => { const closeProcess = () => { search(); getWgetProcess(); + setTimeout(() => { + getWgetProcess(); + }, 1000); }; const processCount = ref(0); const getWgetProcess = async () => { + processCount.value = 0; try { const res = await fileWgetKeys(); if (res.data && res.data.keys.length > 0) {