(fix): use .get() to avoid KeyError (#347)

This commit is contained in:
Travis Abendshien 2024-08-11 19:01:08 -07:00 committed by GitHub
parent ce87b11fbd
commit ec960f2372
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,7 +61,7 @@ def folders_to_tags(library: Library):
library.add_tag_to_library(new_tag)
branch["dirs"][folder] = dict(dirs={}, tag=new_tag)
branch = branch["dirs"][folder]
return branch["tag"]
return branch.get("tag")
for tag in library.tags:
reversed_tag = reverse_tag(library, tag, None)