mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 06:32:59 +08:00
fix: 解决文件复制到原路径导致文件内容清空的 BUG (#798)
This commit is contained in:
parent
936b0e59ab
commit
db2aa35b2f
@ -322,17 +322,21 @@ func (f FileOp) CopyFile(src, dst string) error {
|
||||
}
|
||||
defer srcFile.Close()
|
||||
|
||||
srcInfo, err := f.Fs.Stat(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dstPath := path.Join(dst, srcInfo.Name())
|
||||
if src == dstPath {
|
||||
return nil
|
||||
}
|
||||
|
||||
err = f.Fs.MkdirAll(filepath.Dir(dst), 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
srcInfo, err := f.Fs.Stat(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dstFile, err := f.Fs.OpenFile(path.Join(dst, srcInfo.Name()), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0775)
|
||||
dstFile, err := f.Fs.OpenFile(dstPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0775)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -82,10 +82,10 @@ interface EditorConfig {
|
||||
eol: number;
|
||||
}
|
||||
|
||||
let open = ref(false);
|
||||
let loading = ref(false);
|
||||
const open = ref(false);
|
||||
const loading = ref(false);
|
||||
|
||||
let config = reactive<EditorConfig>({
|
||||
const config = reactive<EditorConfig>({
|
||||
theme: 'vs-dark',
|
||||
language: 'plaintext',
|
||||
eol: monaco.editor.EndOfLineSequence.LF,
|
||||
@ -129,7 +129,7 @@ const handleClose = () => {
|
||||
if (editor) {
|
||||
editor.dispose();
|
||||
}
|
||||
em('close', false);
|
||||
em('close', open.value);
|
||||
};
|
||||
const changeLanguage = () => {
|
||||
monaco.editor.setModelLanguage(editor.getModel(), config.language);
|
||||
|
Loading…
Reference in New Issue
Block a user