[balsa] mime: No trailing comma in a URL



commit f9315755294f8f2ada213efb49cc2e22130b3515
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Aug 23 13:52:39 2021 -0400

    mime: No trailing comma in a URL
    
    The regex that Balsa uses to identify a URL in a plain text message part
    already omits a trailing period ('.') from the match, as it is usually
    punctuation and not part of the URL. This commit additionally removes a comma
    (',') from the last character match, for the same reason: more likely to be
    punctuation. This of course breaks the identification of a URL that *does* end
    in a comma, but that appears to be less likely than erroneously including one.
    
    Discussion at https://gitlab.gnome.org/GNOME/balsa/-/issues/59.

 libbalsa/mime.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/libbalsa/mime.c b/libbalsa/mime.c
index 46f79ad09..ffa4b92c0 100644
--- a/libbalsa/mime.c
+++ b/libbalsa/mime.c
@@ -854,7 +854,9 @@ get_url_reg(void)
         NULL,
         "(((https?|ftps?|nntp)://)|(mailto:|news:))"
             "(%[0-9A-F]{2}|[-_.!~*';/?:@&=+$,#[:alnum:]])+"
-            "(%[0-9A-F]{2}|[-_!~*';/?:@&=+$,#[:alnum:]])",
+            /* do not include a trailing period or comma as part of the match;
+             * it is more likely to be punctuation than part of a URL */
+            "(%[0-9A-F]{2}|[-_!~*';/?:@&=+$#[:alnum:]])",
         __func__,
         "url regex compilation failed"
     };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]