diff options
author | hut <hut@lepus.uberspace.de> | 2015-11-14 03:24:42 +0100 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-11-14 03:24:42 +0100 |
commit | fb15823e9203d53eb0829a68f39665a2f7881993 (patch) | |
tree | 2c82b264e6dd5c886923485ac1bd633fa449fe76 /ranger | |
parent | 4f2fd2d44922acab709fc388ffcabe2f4d754cf1 (diff) | |
parent | 5d1b78a13980b9d4d8103f6d6bedbf484f1be9ff (diff) | |
download | ranger-fb15823e9203d53eb0829a68f39665a2f7881993.tar.gz |
Merge branch 'rifle_ext_condition' of https://github.com/NoSuck/ranger
Diffstat (limited to 'ranger')
-rwxr-xr-x | ranger/ext/rifle.py | 8 |
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': |