[Rt-commit] rt branch, 4.4/make-clicky-trailing-gt, created. rt-4.4.2-39-g2571329

Jim Brandt jbrandt at bestpractical.com
Fri Sep 1 15:38:13 EDT 2017


The branch, 4.4/make-clicky-trailing-gt has been created
        at  25713298207080d3d56a88cab83f99abcecd866e (commit)

- Log -----------------------------------------------------------------
commit 11f57664e0d84da6a62302d95e62c6cc09eeb77f
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Sep 1 15:33:11 2017 -0400

    Tests showing incorrect parsing of link with trailing angle bracket

diff --git a/t/ticket/clicky.t b/t/ticket/clicky.t
index 20d39a3..dc4a3da 100644
--- a/t/ticket/clicky.t
+++ b/t/ticket/clicky.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use Test::More;
-use RT::Test tests => 20;
+use RT::Test tests => undef;
 
 my $plain = MIME::Entity->build(
     Subject => 'plain mime',
@@ -14,6 +14,10 @@ the rt-users\@lists.bestpractical.com.
 
 to test anchor:
 https://wiki.bestpractical.com/test#anchor
+
+and anchor with angle branckets:
+<https://bestpractical.com/test#anchor>
+
 --
 Best regards. BestPractical Team.
 END
@@ -34,7 +38,6 @@ Best regards. BestPractical Team.
 END
 );
 
-
 my $ticket = RT::Ticket->new( RT->SystemUser );
 
 my ($plain_id) = $ticket->Create(
@@ -93,6 +96,13 @@ diag 'test httpurl';
     );
     ok( scalar @links, 'found clicky link with anchor' );
 
+    @links = $m->find_link(
+        tag  => 'a',
+        url  => 'https://bestpractical.com/test#anchor',
+        text => 'Open URL',
+    );
+    ok( scalar @links, 'found clicky link with anchor and angle brackets' );
+
     $m->goto_ticket($html_id);
     @links = $m->find_link(
         tag  => 'a',
@@ -137,5 +147,13 @@ diag 'test httpurl_overwrite';
         text => 'https://wiki.bestpractical.com/test#anchor',
     );
     ok( scalar @links, 'found clicky link with anchor' );
+
+    @links = $m->find_link(
+        tag  => 'a',
+        url  => 'https://bestpractical.com/test#anchor',
+        text => 'https://bestpractical.com/test#anchor',
+    );
+    ok( scalar @links, 'found clicky link with anchor and angle brackets' );
 }
 
+done_testing();

commit 25713298207080d3d56a88cab83f99abcecd866e
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Sep 1 15:33:58 2017 -0400

    Add > as another character to exclude when parsing a URL anchor
    
    A user reported that for URLs with an anchor (in the form #anchor)
    and a trailing >, MakeClicky would include the > in the parsed URL,
    creating an incorrect link. Add > to the characters to exclude.

diff --git a/share/html/Elements/MakeClicky b/share/html/Elements/MakeClicky
index 252711b..ae865c0 100644
--- a/share/html/Elements/MakeClicky
+++ b/share/html/Elements/MakeClicky
@@ -80,12 +80,12 @@ my %actions = (
 my @types = (
     {
         name   => "httpurl",
-        regex  => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}(?:#[^\s<]+)?(?<![.?!,;:])/,
+        regex  => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}(?:#[^\s<]+)?(?<![.?!,;:>])/,
         action => "url",
     },
     {
         name   => "httpurl_overwrite",
-        regex  => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}(?:#[^\s<]+)?(?<![.?!,;:])/,
+        regex  => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}(?:#[^\s<]+)?(?<![.?!,;:>])/,
         action => "url_overwrite",
     },
 );

-----------------------------------------------------------------------


More information about the rt-commit mailing list