From ed0134dbe552281278b5d6f0864c6a7d7fae32e0 Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Wed, 9 Oct 2024 15:56:30 +0100 Subject: message: Fix more url parsing issues --- src/message.py | 5 +++-- 1 file 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"{link}" + marked_url = GLib.markup_escape_text(link) + result = GLib.markup_escape_text(escaped) + f"{marked_url}" return result + self.parse_message(message, res_span[1]) else: return GLib.markup_escape_text(message[pos:]) -- cgit