[libparse-debianchangelog-perl] 38/52: http_ftp_urls: Fix conversion of <http://something/>

Intrigeri intrigeri at moszumanska.debian.org
Sun May 24 12:37:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch master
in repository libparse-debianchangelog-perl.

commit 26beeef7af8066a868ca283c53f4157197b0315f
Author: Frank Lichtenheld <frank at lichtenheld.de>
Date:   Mon Apr 4 17:20:14 2011 +0200

    http_ftp_urls: Fix conversion of <http://something/>
    
    Combines some nifty pieces of regex magic.
---
 Changes                                     |  7 +++++++
 lib/Parse/DebianChangelog/ChangesFilters.pm |  4 ++--
 t/Parse-DebianChangelog-ChangesFilters.t    | 16 +++++++---------
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Changes b/Changes
index 0c11552..4b5bbf0 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+Parse-DebianChangelog (1.2.0) unstable; urgency=low
+
+  * ChangelogFilters:
+    - Fix conversion of <http://something/> (Closes: #603341)
+
+ -- Frank Lichtenheld <frank at lichtenheld.de>  Mon, 04 Apr 2011 16:43:54 +0200
+
 Parse-DebianChangelog (1.1.1) unstable; urgency=low
 
   * Bug fixes:
diff --git a/lib/Parse/DebianChangelog/ChangesFilters.pm b/lib/Parse/DebianChangelog/ChangesFilters.pm
index 9af527a..1309124 100644
--- a/lib/Parse/DebianChangelog/ChangesFilters.pm
+++ b/lib/Parse/DebianChangelog/ChangesFilters.pm
@@ -73,8 +73,8 @@ sub http_ftp_urls {
     $text=~ s|<URL:([-\w\.\/:~_\@]+):([a-zA-Z0-9\'() ]+)>
         |$cgi->a({ -href=>$1 }, $2)
 	|xego;
-    $text=~ s|https?:[\w/\.:\@+\-~\%\#?=&;,]+[\w/]
-	|$cgi->a({ -href=>$& }, $&)
+    $text=~ s|(<)?\K(https?:[\w/\.:\@+\-~\%\#?=&;,]+[\w/])(?(1)(?=>))
+	|$cgi->a({ -href=>$2 }, $2)
 	|xego;
     $text=~ s|ftp:[\w/\.:\@+\-~\%\#?=&;,]+[\w/]
 	|$cgi->a({ -href=>$& }, $&)
diff --git a/t/Parse-DebianChangelog-ChangesFilters.t b/t/Parse-DebianChangelog-ChangesFilters.t
index 2c6c086..071fba9 100644
--- a/t/Parse-DebianChangelog-ChangesFilters.t
+++ b/t/Parse-DebianChangelog-ChangesFilters.t
@@ -33,16 +33,12 @@ is( $text,
     'foo <a href="http://foo.com/cgi-bin/t.cgi?id=bar&name=bar">http://foo.com/cgi-bin/t.cgi?id=bar&name=bar</a> bar',
     'http_ftp_urls' );
 
-TODO: {
-    local $TODO = 'bug in detection code';
-
-    $text = http_ftp_urls( 'foo <http://foo.com/cgi-bin/t.cgi?id=bar&name=bar> bar',
-			   $cgi );
+$text = http_ftp_urls( 'foo <http://foo.com/cgi-bin/t.cgi?id=bar&name=bar> bar',
+		       $cgi );
 
-    is( $text,
-	'foo <<a href="http://foo.com/cgi-bin/t.cgi?id=bar&name=bar">http://foo.com/cgi-bin/t.cgi?id=bar&name=bar</a>> bar',
-	'http_ftp_urls with complicated embedding' );
-}
+is( $text,
+    'foo <<a href="http://foo.com/cgi-bin/t.cgi?id=bar&name=bar">http://foo.com/cgi-bin/t.cgi?id=bar&name=bar</a>> bar',
+    'http_ftp_urls with complicated embedding' );
 
 $text = email_to_ddpo( 'Frank Lichtenheld <djpig at debian.org>', $cgi );
 
@@ -81,6 +77,7 @@ is( $text,
 my $complete_text = <<'EOT';
 hällö & tschüß <tt id="a">:)</tt>
 foo http://foo.com/cgi-bin/t.cgi?id=bar&name=bar bar
+foo <http://foo.com/cgi-bin/t.cgi?id=bar&name=bar> bar
 Frank Lichtenheld <djpig at debian.org>
 This (Closes: #123456, Bug#4321, #222) (hopefully, maybe closes #72345, too)
 SECURITY FIXES (CAN-2005-9999, CVE-2004-9999):
@@ -92,6 +89,7 @@ EOT
 my $complete_result = <<'EOR';
 hällö & tschüß <tt id="a">:)</tt>
 foo <a href="http://foo.com/cgi-bin/t.cgi?id=bar&name=bar">http://foo.com/cgi-bin/t.cgi?id=bar&name=bar</a> bar
+foo <<a href="http://foo.com/cgi-bin/t.cgi?id=bar&name=bar">http://foo.com/cgi-bin/t.cgi?id=bar&name=bar</a>> bar
 Frank Lichtenheld <<a href="http://qa.debian.org/developer.php?login=djpig@debian.org">djpig at debian.org</a>>
 This (Closes: <a class="buglink" href="http://bugs.debian.org/123456">#123456</a>, <a class="buglink" href="http://bugs.debian.org/4321">Bug#4321</a>, <a class="buglink" href="http://bugs.debian.org/222">#222</a>) (hopefully, maybe closes #72345, too)
 SECURITY FIXES (<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-9999">CAN-2005-9999</a>, <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-9999">CVE-2004-9999</a>):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libparse-debianchangelog-perl.git



More information about the Pkg-perl-cvs-commits mailing list