[Bps-public-commit] Net-Trac branch, master, updated. 1219d76139ea079f12c09c76a49f558a256ea146

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Jun 10 10:44:16 EDT 2009


The branch, master has been updated
       via  1219d76139ea079f12c09c76a49f558a256ea146 (commit)
       via  0e241b8ddfa3699de6235f39b99dce023c2dc172 (commit)
      from  29370f9f53ae171cda4a0a5ba33c224fc0712573 (commit)

Summary of changes:
 lib/Net/Trac/TicketAttachment.pm   |    7 +++++--
 lib/Net/Trac/TicketHistoryEntry.pm |    8 ++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 0e241b8ddfa3699de6235f39b99dce023c2dc172
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 10 22:41:15 2009 +0800

    fix the bug of "Fetching attachments with trailing spaces loses"

diff --git a/lib/Net/Trac/TicketAttachment.pm b/lib/Net/Trac/TicketAttachment.pm
index 5eb500a..80e1e65 100644
--- a/lib/Net/Trac/TicketAttachment.pm
+++ b/lib/Net/Trac/TicketAttachment.pm
@@ -4,6 +4,7 @@ use warnings;
 package Net::Trac::TicketAttachment;
 
 use Any::Moose;
+use URI::Escape qw(uri_escape);
 
 =head1 NAME
 
@@ -123,8 +124,10 @@ sub _parse_html_chunk {
     
 
     $self->filename($1) if $html =~ qr{<a (?:.+?) title="View attachment">(.+?)</a>};
-    $self->url( "/raw-attachment/ticket/" . $self->ticket . "/" . $self->filename )
-        if defined $self->filename;
+    $self->url( "/raw-attachment/ticket/"
+          . $self->ticket . "/"
+          . uri_escape( $self->filename ) )
+      if defined $self->filename;
 
     $self->size($1)   if $html =~ qr{<span title="(\d+) bytes">};
     $self->author($1) if $html =~ qr{added by (?:<em>)?\s*(\w+)};
diff --git a/lib/Net/Trac/TicketHistoryEntry.pm b/lib/Net/Trac/TicketHistoryEntry.pm
index c2bb58b..b0a0f97 100644
--- a/lib/Net/Trac/TicketHistoryEntry.pm
+++ b/lib/Net/Trac/TicketHistoryEntry.pm
@@ -7,6 +7,7 @@ use Any::Moose;
 use Net::Trac::TicketPropChange;
 use DateTime;
 use HTTP::Date;
+use URI::Escape qw(uri_escape);
 
 =head1 NAME
 
@@ -132,8 +133,11 @@ sub _parse_props {
         my ( $prop, $old, $new );
         if ( $line =~ m{<strong>attachment</strong>} ) {
             my ($name) = $line =~ m!<em>(.*?)</em>!;
-            my $content = $self->connection->_fetch( "/attachment/ticket/" . $self->ticket->id . "/$name" )
-                or next;
+            my $content =
+              $self->connection->_fetch( "/attachment/ticket/"
+                  . $self->ticket->id . '/'
+                  . uri_escape($name) )
+              or next;
 
             if ( $content =~ m{<div id="content" class="attachment">(.+?)</div>}is ) {
                 my $frag = $1;

commit 1219d76139ea079f12c09c76a49f558a256ea146
Merge: 0e241b8... 29370f9...
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 10 22:41:43 2009 +0800

    Merge branch 'master' of code.bestpractical.com:/git/net-trac


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



More information about the Bps-public-commit mailing list