From 9d1c64bcdb757a78369e8d9d480d2e5b70a51980 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Mon, 3 Feb 2014 22:51:43 +0100 Subject: [PATCH] Fix thumbnail path check for directories without images (ref #68). --- sigal/gallery.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sigal/gallery.py b/sigal/gallery.py index c8e2647..8fd370f 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -128,6 +128,12 @@ class PathsDb(object): # dir without images, start with the deepest ones for path in reversed(sorted(path_nomedia, key=lambda x: x.count('/'))): + # stop if it is already set and a valid file + alb_thumb = self.db[path].setdefault('thumbnail', '') + if alb_thumb and os.path.isfile(join(self.basepath, path, + alb_thumb)): + break + for subdir in self.get_subdirs(path): # use the thumbnail of their sub-directories if self.db[subdir].get('thumbnail', ''):