]> git.ipfire.org Git - ipfire.org.git/commitdiff
dbl: Remove any leading/trailing dots from the search
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 24 Jan 2026 16:25:06 +0000 (16:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 24 Jan 2026 16:25:06 +0000 (16:25 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/dbl.py

index 0f48c3bc24369d1f06354d1059b41f88721b6550..fc503879c83202268f7a230cc48a474c23b33f66 100644 (file)
@@ -155,6 +155,14 @@ class SearchHandler(base.AnalyticsMixin, BaseHandler):
                if not q:
                        raise tornado.web.HTTPError(400, "Empty search query")
 
+               # Remove any leading dots
+               while q.startswith("."):
+                       q = q.removeprefix(".")
+
+               # Remove any trailing dots
+               while q.endswith("."):
+                       q = q.removesuffix(".")
+
                # Search for the query
                try:
                        results = await self.backend.dbl.search(q)