]> git.ipfire.org Git - dbl.git/commitdiff
api: Don't try to search for a list if none exists
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Mar 2026 14:53:39 +0000 (14:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Mar 2026 14:53:39 +0000 (14:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dbl/api/reports.py

index 9eedb179f9c3db69f54f0a7e551f2ffe30619a39..f6bee181cb50071d86a27561a8b8d8685d66e8d1 100644 (file)
@@ -85,9 +85,10 @@ async def get_reports(
                limit: int | None = None,
 ) -> typing.List[reports.Report]:
        # Fetch the list
-       list = await backend.lists.get_by_slug(list)
-       if not list:
-               raise fastapi.HTTPException(400, "Could not find list '%s'" % list)
+       if list:
+               list = await backend.lists.get_by_slug(list)
+               if not list:
+                       raise fastapi.HTTPException(400, "Could not find list '%s'" % list)
 
        # Fetch all reports
        reports = backend.reports.get(