summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2019-10-01 22:50:12 +0200
committertoonn <toonn@toonn.io>2019-11-07 09:54:54 +0100
commit1670524723da7c0ff00b23c02f22fb98f1bc6286 (patch)
treee62eff0fbe17648b9944df69ea1fb3f3b3199533
parentdab04350b2a3d55e762b0a2f855c5faf4ca61d61 (diff)
downloadranger-1670524723da7c0ff00b23c02f22fb98f1bc6286.tar.gz
Check current dir exists when pasting
I changed the default `dest` for paste to the value that's used if
`None` were passed to the `CopyLoader`, i.e., `self.thistab.path`,
because the current directory was bypassing the `isdir()` check
otherwise.

Fixes #1660
-rw-r--r--ranger/core/actions.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 25b01e2c..fe4b7967 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1591,19 +1591,19 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
                 link(source_path,
                      next_available_filename(target_path))
 
-    def paste(self, overwrite=False, append=False, dest=None):
+    def paste(self, overwrite=False, append=False, dest=self.thistab.path):
         """:paste
 
         Paste the selected items into the current directory or to dest
         if provided.
         """
-        if dest is None or isdir(dest):
+        if isdir(dest):
             loadable = CopyLoader(self.copy_buffer, self.do_cut, overwrite,
                                   dest)
             self.loader.add(loadable, append=append)
             self.do_cut = False
         else:
-            self.notify('Failed to paste. The given path is invalid.', bad=True)
+            self.notify('Failed to paste. The destination is invalid.', bad=True)
 
     def delete(self, files=None):
         # XXX: warn when deleting mount points/unseen marked files?