summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2019-01-26 00:22:10 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2019-01-26 00:35:19 +0100
commitb3a637834bf7181276e4dcd1c6c9231a85b614dc (patch)
treeaa6b9aaca97292b25f25296aa9c64ad7d5e32455 /ranger
parent505dd0b4d327d908e131930f45b8984426836833 (diff)
downloadranger-b3a637834bf7181276e4dcd1c6c9231a85b614dc.tar.gz
container.bookmarks: Remove invalid bookmarks only on access
Previously ranger was validating the bookmarks (whether they are existing
directories) when loading the bookmark file.  It caused the remote
filesystems like autofs to wake up unnecessarily and in general caused
more problems than solved.

Fixes #1365.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/bookmarks.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index cbfc541a..e1a88fa2 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -88,7 +88,12 @@ class Bookmarks(FileManagerAware):
         if key == '`':
             key = "'"
         if key in self.dct:
-            return self.dct[key]
+            value = self.dct[key]
+            if os.path.isdir(value.path):
+                return value
+            else:
+                del self[key]
+                raise KeyError("Invalid Bookmark: `%s'!" % key)
         else:
             raise KeyError("Nonexistant Bookmark: `%s'!" % key)
 
@@ -229,7 +234,7 @@ class Bookmarks(FileManagerAware):
         for line in fobj:
             if self.load_pattern.match(line):
                 key, value = line[0], line[2:-1]
-                if key in ALLOWED_KEYS and not os.path.isfile(value):
+                if key in ALLOWED_KEYS:
                     dct[key] = self.bookmarktype(value)
         fobj.close()
         return dct