summary refs log tree commit diff stats
path: root/ranger/container/file.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/container/file.py')
-rw-r--r--ranger/container/file.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ranger/container/file.py b/ranger/container/file.py
index e0b9922c..88097a2c 100644
--- a/ranger/container/file.py
+++ b/ranger/container/file.py
@@ -55,7 +55,10 @@ class File(FileSystemObject):
         if self._firstbytes is None:
             try:
                 with open(self.path, 'r') as fobj:
-                    self._firstbytes = fobj.read(N_FIRST_BYTES)
+                    try:
+                        self._firstbytes = fobj.read(N_FIRST_BYTES)
+                    except UnicodeDecodeError:
+                        return None
             except OSError:
                 return None
         return self._firstbytes