summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2019-03-05 00:12:57 +0100
committertoonn <toonn@toonn.io>2019-03-05 00:12:57 +0100
commitc25ab7a079b6d490b4413ef0e0ffe409a3f1b763 (patch)
treebf2b3305fb81c8ff26f6b7c321bd297f92c57ce6
parent51e7383ad5ebdf35374d62b44ca57ad58ce339cb (diff)
downloadranger-c25ab7a079b6d490b4413ef0e0ffe409a3f1b763.tar.gz
Fix dest check for :paste
The new destination argument for `:paste` requires a guard on whether it
is a valid target. A bug snuck in because of copious negation : )
This is now fixed, we only allow the target to be a directory or `None`
which means the current tab's working directory.
-rw-r--r--ranger/core/actions.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 3868d102..8e98432a 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1565,13 +1565,13 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
         Paste the selected items into the current directory or to dest
         if provided.
         """
-        if dest is not None:
-            if not exists(dest) and not isdir(dest):
-                self.notify('Failed to paste. The given path is invalid.', bad=True)
-                return
-        loadable = CopyLoader(self.copy_buffer, self.do_cut, overwrite, dest=dest)
-        self.loader.add(loadable, append=append)
-        self.do_cut = False
+        if dest is None or 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)
 
     def delete(self, files=None):
         # XXX: warn when deleting mount points/unseen marked files?