diff options
author | Michael Ilsaas <mikeri@mikeri.net> | 2018-04-27 22:13:51 +0200 |
---|---|---|
committer | Michael Ilsaas <mikeri@mikeri.net> | 2018-04-27 22:13:51 +0200 |
commit | 3db6e6af38c45e01605d2f143281b59f6efc79db (patch) | |
tree | fe34ef2e4e36be360e67c42b958e6738cb148c06 | |
parent | a30b5e5b517a04f35e79a41a624aaedf187f6a36 (diff) | |
download | ranger-3db6e6af38c45e01605d2f143281b59f6efc79db.tar.gz |
ext.rifle: Additional Check for mime type with mimetype command
-rwxr-xr-x | ranger/ext/rifle.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index 70215039..69a561a8 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -261,6 +261,11 @@ class Rifle(object): # pylint: disable=too-many-instance-attributes process = Popen(["file", "--mime-type", "-Lb", fname], stdout=PIPE, stderr=PIPE) mimetype, _ = process.communicate() self._mimetype = mimetype.decode(ENCODING).strip() + if self._mimetype == 'application/octet-stream': + process = Popen(["mimetype", "--output-format", "%m", fname], + stdout=PIPE, stderr=PIPE) + mimetype, _ = process.communicate() + self._mimetype = mimetype.decode(ENCODING).strip() return self._mimetype def _build_command(self, files, action, flags): |