diff --git a/dj_iconify/util.py b/dj_iconify/util.py index 10dcb4395e1bb0148fb93f3c122f1803a5f58be6..50e0859ad225286a03dc1002e04347dde804fb85 100644 --- a/dj_iconify/util.py +++ b/dj_iconify/util.py @@ -41,6 +41,9 @@ def icon_choices(collection: str) -> list[tuple[str, str]]: from .types import IconifyJSON + if not collection_allowed(collection): + raise KeyError("The collection %s is disallowed." % collection) + # Load icon set through Iconify types collection_file = os.path.join(JSON_ROOT, "json", f"{collection}.json") icon_set = IconifyJSON.from_file(collection_file)