summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/container/file.py2
-rw-r--r--ranger/container/settings.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/ranger/container/file.py b/ranger/container/file.py
index 7c11dc63..3205ce61 100644
--- a/ranger/container/file.py
+++ b/ranger/container/file.py
@@ -68,6 +68,8 @@ class File(FileSystemObject):
             return False
         if not self.accessible:
             return False
+        if self.size > self.fm.settings.preview_max_size:
+            return False
         if self.fm.settings.preview_script and \
                 self.fm.settings.use_preview_script:
             return True
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 58ddffc9..29e6d729 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -31,6 +31,7 @@ ALLOWED_SETTINGS = {
     'preview_files': bool,
     'preview_images': bool,
     'preview_script': (str, type(None)),
+    'preview_max_size': int,
     'save_console_history': bool,
     'scroll_offset': int,
     'shorten_title': int,