[gnome-terminal] regex: Disallow terminating semicolon in URLs



commit 2a6ceba43b6ad8e884920da4eca96ffbcfed34b5
Author: Egmont Koblinger <egmont gmail com>
Date:   Sun Dec 17 23:45:42 2017 +0100

    regex: Disallow terminating semicolon in URLs

 src/terminal-regex.c |    2 ++
 src/terminal-regex.h |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/terminal-regex.c b/src/terminal-regex.c
index 33f8ec9..cf06b76 100644
--- a/src/terminal-regex.c
+++ b/src/terminal-regex.c
@@ -235,6 +235,8 @@ main (int argc, char **argv)
   assert_match (REGEX_URL_AS_IS, "Visit http://example.com for details",        "http://example.com";);
   assert_match (REGEX_URL_AS_IS, "Trailing dot http://foo/bar.html.";,           "http://foo/bar.html";);
   assert_match (REGEX_URL_AS_IS, "Trailing ellipsis http://foo/bar.html...";,    "http://foo/bar.html";);
+  assert_match (REGEX_URL_AS_IS, "Trailing comma http://foo/bar,baz,";,          "http://foo/bar,baz";);
+  assert_match (REGEX_URL_AS_IS, "Trailing semicolon http://foo/bar;baz;";,      "http://foo/bar;baz";);
   assert_match (REGEX_URL_AS_IS, "See <http://foo/bar>",                        "http://foo/bar";);
   assert_match (REGEX_URL_AS_IS, "<http://foo.bar/asdf.qwer.html>",             
"http://foo.bar/asdf.qwer.html";);
   assert_match (REGEX_URL_AS_IS, "Go to http://192.168.1.1.";,                   "http://192.168.1.1";);
diff --git a/src/terminal-regex.h b/src/terminal-regex.h
index 5ca2f22..7136f95 100644
--- a/src/terminal-regex.h
+++ b/src/terminal-regex.h
@@ -124,7 +124,7 @@
 /* Omit the parentheses, see below */
 #define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%\\E]"
 /* Chars to end a URL */
-#define PATHTERM_CLASS "[-[:alnum:]\\Q_$+*:;@&=/~#|%\\E]"
+#define PATHTERM_CLASS "[-[:alnum:]\\Q_$+*:@&=/~#|%\\E]"
 
 /* Recursive definition of PATH that allows parentheses and square brackets only if balanced, see bug 
763980. */
 #define PATH_INNER_DEF "(?(DEFINE)(?<PATH_INNER>(?x: (?: " PATHCHARS_CLASS "* (?: \\( (?&PATH_INNER) \\) | 
\\[ (?&PATH_INNER) \\] ) )* " PATHCHARS_CLASS "* )))"


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