summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThe Flying Rapist <admin@nosuck.org>2015-10-24 14:00:36 -0400
committerThe Flying Rapist <admin@nosuck.org>2015-10-24 14:00:36 -0400
commit5d1b78a13980b9d4d8103f6d6bedbf484f1be9ff (patch)
treeddaef540f998da2378149f3c68bee4d499c21e74
parentede5bf0f3f325e1df64f09c5b387d750d216a4a3 (diff)
downloadranger-5d1b78a13980b9d4d8103f6d6bedbf484f1be9ff.tar.gz
Rifle's ext condition now handles fringe cases.
-rwxr-xr-xranger/ext/rifle.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 5d13a5bf..3c54cfc2 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -194,9 +194,11 @@ class Rifle(object):
         function = rule[0]
         argument = rule[1] if len(rule) > 1 else ''
 
-        if function == 'ext':
-            extension = os.path.basename(files[0]).rsplit('.', 1)[-1].lower()
-            return bool(re.search('^(' + argument + ')$', extension))
+        if function == 'ext' and os.path.isfile(files[0]):
+            partitions = os.path.basename(files[0]).rpartition('.')
+            if not partitions[0]:
+                return False
+            return bool(re.search('^(' + argument + ')$', partitions[2].lower()))
         elif function == 'name':
             return bool(re.search(argument, os.path.basename(files[0])))
         elif function == 'match':