From 37fb8fcf58916424c62249f57d9e96eb653881d6 Mon Sep 17 00:00:00 2001 From: Raelon Masters Date: Sat, 18 Jul 2020 02:22:08 -0400 Subject: [PATCH] Fixed a bug where makeCollections would fail based on certain permutations of file naming --- src/backend/lib/storage.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/lib/storage.py b/src/backend/lib/storage.py index 0969707..f82c1ec 100755 --- a/src/backend/lib/storage.py +++ b/src/backend/lib/storage.py @@ -114,7 +114,6 @@ class Storage: return True def make_collections(self): - breakpoint() _title_regx = re.compile(r"^[0-9][0-9]*|-|\ \B") _q = "SELECT id,file_name FROM books" self.cursor.execute(_q) @@ -123,8 +122,11 @@ class Storage: path = self.config.book_path + "/" _collections = [] _pathing = book[1].split(path)[1].split("/") - _pathing.pop(0) - _pathing.pop(-1) + try: + _pathing.pop(0) + _pathing.pop(-1) + except IndexError: + continue for _p in _pathing: _s = _p.replace("'", "") _x = re.sub(_title_regx, "", _s)