mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-27 09:49:28 +08:00
fix(file): fix issue with copy file failed (#8153)
This commit is contained in:
parent
7eeca73337
commit
80a0afc135
4 changed files with 19 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -437,6 +437,7 @@ const initEditor = () => {
|
|||
minimap: {
|
||||
enabled: config.minimap,
|
||||
},
|
||||
lineNumbersMinChars: 6,
|
||||
});
|
||||
if (editor.getModel().getValue() === '') {
|
||||
let defaultContent = '\n\n\n\n';
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue