From 33429136a25ce6744e31a6d62a8779c575c3ff4b Mon Sep 17 00:00:00 2001 From: Jacob Rief Date: Tue, 3 Dec 2024 09:24:42 +0100 Subject: [PATCH] fix ISE when last_folder_id points to non-existing Folder --- finder/browser/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/finder/browser/views.py b/finder/browser/views.py index 86021c14f..17c5445bd 100644 --- a/finder/browser/views.py +++ b/finder/browser/views.py @@ -72,9 +72,12 @@ def structure(self, request, slug): # direct children of the root folder are open regardless of the `open_folders` session # in addition to that, also open all ancestors of the last opened folder open_folders = set(request.session['finder.open_folders']) - open_folders.update( - map(str, FolderModel.objects.get(id=last_folder_id).ancestors.values_list('id', flat=True)) - ) + try: + open_folders.update( + map(str, FolderModel.objects.get(id=last_folder_id).ancestors.values_list('id', flat=True)) + ) + except FolderModel.DoesNotExist: + pass children = self._get_children(open_folders, realm.root_folder) else: children = None