geminispace.info

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/geminispace.info.git
Log | Files | Refs | README | LICENSE

commit 5ad2a1e64d4b4dd19d4dd878446996d53826affb
parent d7518388dd0fa358d7ae454d3feeb1fb7e6c2aa7
Author: Natalie Pendragon <natpen@natpen.net>
Date:   Fri,  3 Jul 2020 11:45:23 -0400

[serve] Fix minor bug in counting of backlinks

Empty backlink strings were getting counted as "1" instead of "0".

Diffstat:
Mserve/models.py | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/serve/models.py b/serve/models.py @@ -51,7 +51,7 @@ class GUS(): "prompt" : result["prompt"] if "prompt" in result else "", "highlights" : self.gemini_highlighter.highlight_hit(result, "content", top=1) if "content" in result and result["content_type"] in ["text/plain", "text/gemini", "text/markdown"] else "", "link_text" : GUS._get_link_text(result), - "backlinks" : result["backlinks"].split(" ") if "backlinks" in result else [], + "backlinks" : result["backlinks"].split(" ") if "backlinks" in result and result["backlinks"] != "" else [], } for result in results], ) @@ -59,7 +59,7 @@ class GUS(): def get_backlinks(self, url): resource = GeminiResource(url) result = self.searcher.document(url_id=resource.indexable_url) - return result["backlinks"].split(" ") if result and "backlinks" in result else [] + return result["backlinks"].split(" ") if result and "backlinks" in result and result["backlinks"] != "" else [] def _get_link_text(result):