diff options
author | toonn <toonn@toonn.io> | 2018-04-28 23:24:56 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2018-04-28 23:24:56 +0200 |
commit | c01a7016b869c452d18fd8b96256ec178dc61215 (patch) | |
tree | 2356d59ba151172c318eb5267f1a2e0156532a3f | |
parent | a30b5e5b517a04f35e79a41a624aaedf187f6a36 (diff) | |
parent | 9f60ca76603e820b1e2f26f91880ca05ec0d75f4 (diff) | |
download | ranger-c01a7016b869c452d18fd8b96256ec178dc61215.tar.gz |
Merge branch 'mikeri-master'
-rwxr-xr-x | ranger/ext/rifle.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index 70215039..672b0597 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -261,6 +261,14 @@ 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': + try: + process = Popen(["mimetype", "--output-format", "%m", fname], + stdout=PIPE, stderr=PIPE) + mimetype, _ = process.communicate() + self._mimetype = mimetype.decode(ENCODING).strip() + except OSError: + pass return self._mimetype def _build_command(self, files, action, flags): |