Fix crash when pasting into directory without permissions (#2024)

This commit is contained in:
Joe Lim authored and GitHub committed 2025-07-02 11:08:24 +10:00
1 parent 0639e71171
commit e47b2fda08
2 files changed
+8 -9

No files matched your search

+1 -2
View File
@@ -104,8 +104,7 @@ func copyAll(srcs []string, dstDir string, preserve []string) (nums chan int64,
file := filepath.Base(src) file := filepath.Base(src)
dst := filepath.Join(dstDir, file) dst := filepath.Join(dstDir, file)
lstat, err := os.Lstat(dst) if lstat, err := os.Lstat(dst); err == nil {
if !os.IsNotExist(err) {
ext := getFileExtension(lstat) ext := getFileExtension(lstat)
basename := file[:len(file)-len(ext)] basename := file[:len(file)-len(ext)]
var newPath string var newPath string
+7 -7
View File
@@ -1357,13 +1357,13 @@ func (nav *nav) moveAsync(app *app, srcs []string, dstDir string) {
file := filepath.Base(src) file := filepath.Base(src)
dst := filepath.Join(dstDir, file) dst := filepath.Join(dstDir, file)
dstStat, err := os.Stat(dst) if dstStat, err := os.Stat(dst); err == nil {
if os.SameFile(srcStat, dstStat) { if os.SameFile(srcStat, dstStat) {
errCount++ errCount++
echo.args[0] = fmt.Sprintf("[%d] rename %s %s: source and destination are the same file", errCount, src, dst) echo.args[0] = fmt.Sprintf("[%d] rename %s %s: source and destination are the same file", errCount, src, dst)
app.ui.exprChan <- echo app.ui.exprChan <- echo
continue continue
} else if !os.IsNotExist(err) { }
ext := getFileExtension(dstStat) ext := getFileExtension(dstStat)
basename := file[:len(file)-len(ext)] basename := file[:len(file)-len(ext)]
var newPath string var newPath string