diff options
author | hut <hut@lavabit.com> | 2010-04-04 01:05:42 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-04 01:06:55 +0200 |
commit | 8152892eb7bb2852f3c9d2d2dd3cd5af723a61e1 (patch) | |
tree | f71548fe01c4bbceef5d7f4263dac9e3e362ddfc | |
parent | 30ae21371fbce8e34bf29ea32e6437f08103c54a (diff) | |
download | ranger-8152892eb7bb2852f3c9d2d2dd3cd5af723a61e1.tar.gz |
widgets.browserview: don't preview FIFOs!
Thanks to JohannesSM64
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 6f414cf6..fb619787 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -15,6 +15,7 @@ """The BrowserColumn widget displays the contents of a directory or file.""" import re +import stat from time import time from . import Widget @@ -161,10 +162,14 @@ class BrowserColumn(Pager): self.last_redraw_time = time() def _preview_this_file(self, target): - if not self.settings.preview_files: - return False - if not self.target or not self.target.is_file: + if not (target \ + and self.settings.preview_files \ + and target.is_file \ + and target.accessible \ + and target.stat): + and not target.stat.st_mode & stat.S_IFIFO): return False + maxsize = self.settings.max_filesize_for_preview if maxsize is not None and target.size > maxsize: return False |