Fix crash when pasting into directory without permissions (#2024)
This commit is contained in:
1 parent
0639e71171
commit
e47b2fda08
2 files changed
+8
-9
No files matched your search
@@ -104,8 +104,7 @@ func copyAll(srcs []string, dstDir string, preserve []string) (nums chan int64,
|
||||
file := filepath.Base(src)
|
||||
dst := filepath.Join(dstDir, file)
|
||||
|
||||
lstat, err := os.Lstat(dst)
|
||||
if !os.IsNotExist(err) {
|
||||
if lstat, err := os.Lstat(dst); err == nil {
|
||||
ext := getFileExtension(lstat)
|
||||
basename := file[:len(file)-len(ext)]
|
||||
var newPath string
|
||||
|
||||
@@ -1357,13 +1357,13 @@ func (nav *nav) moveAsync(app *app, srcs []string, dstDir string) {
|
||||
file := filepath.Base(src)
|
||||
dst := filepath.Join(dstDir, file)
|
||||
|
||||
dstStat, err := os.Stat(dst)
|
||||
if os.SameFile(srcStat, dstStat) {
|
||||
errCount++
|
||||
echo.args[0] = fmt.Sprintf("[%d] rename %s %s: source and destination are the same file", errCount, src, dst)
|
||||
app.ui.exprChan <- echo
|
||||
continue
|
||||
} else if !os.IsNotExist(err) {
|
||||
if dstStat, err := os.Stat(dst); err == nil {
|
||||
if os.SameFile(srcStat, dstStat) {
|
||||
errCount++
|
||||
echo.args[0] = fmt.Sprintf("[%d] rename %s %s: source and destination are the same file", errCount, src, dst)
|
||||
app.ui.exprChan <- echo
|
||||
continue
|
||||
}
|
||||
ext := getFileExtension(dstStat)
|
||||
basename := file[:len(file)-len(ext)]
|
||||
var newPath string
|
||||
|
||||
Reference in new issue
Block a user