From 50e9417d87a02ddbd4959038e205f122b26e8265 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 18 Sep 2019 09:37:42 +0100 Subject: [PATCH] Prevent links from becoming too long --- content.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content.py b/content.py index a4bcb9e8..2496f913 100644 --- a/content.py +++ b/content.py @@ -44,7 +44,11 @@ def addWebLinks(content: str) -> str: markup+='' elif w.startswith('http://'): markup+='' - markup+=''+w.replace('https://','').replace('http://','')+'' + linkText=w.replace('https://','').replace('http://','') + # prevent links from becoming too long + if len(linkText)>50: + linkText=linkText[:50] + markup+=''+linkText+'' replaceDict[w]=markup for url,markup in replaceDict.items(): content=content.replace(url,markup)