Now About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/message.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/message.py b/src/message.py
index e61957d..128dbed 100644
--- a/src/message.py
+++ b/src/message.py
@@ -20,7 +20,7 @@ from gi.repository import Adw, Gtk, GLib, Pango
import re
-re_url_exp = r"(\S+://[A-Za-z0-9_.\-~/@]+)"
+re_url_exp = r"([A-Za-z0-9_.\-~/@]+://[A-Za-z0-9_.\-~/@?=&%#]+)"
re_url = re.compile(re_url_exp)
@Gtk.Template(resource_path='/com/fryzekconcepts/weegtk/gtk/message.ui')
@@ -46,7 +46,8 @@ class WeegtkMessage(Gtk.Box):
res_span = res.span()
escaped = message[pos:res_span[0]]
link = res.group()
- result = GLib.markup_escape_text(escaped) + f"<a href=\"{link}\">{link}</a>"
+ marked_url = GLib.markup_escape_text(link)
+ result = GLib.markup_escape_text(escaped) + f"<a href=\"{marked_url}\">{marked_url}</a>"
return result + self.parse_message(message, res_span[1])
else:
return GLib.markup_escape_text(message[pos:])