Skip to content

Commit

Permalink
fix ISE when last_folder_id points to non-existing Folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Dec 3, 2024
1 parent 9ba8fb5 commit 3342913
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions finder/browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3342913

Please sign in to comment.