commit 46dff2549af9ca8a6408275ced77be5fddcb5397
parent c74caeb975ca120edf75f8d0a6bb865a1c144952
Author: Natalie Pendragon <natpen@natpen.net>
Date: Sat, 11 Jul 2020 06:56:49 -0400
[serve] Improve safety of backlinks code path
Before, it would throw an unhandled exception if the user entered an
invalid URL as their backlinks query.
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/serve/models.py b/serve/models.py
@@ -63,6 +63,8 @@ class GUS():
def get_backlinks(self, url):
resource = GeminiResource(url)
+ if not resource.is_valid:
+ return []
backlinks = []
result = self.searcher.document(url_id=resource.indexable_url.rstrip("/"))