Bjoern Hoehrmann <[EMAIL PROTECTED]> writes:

> Hi,
> 
>   print URI->new('data:;base64,QmpvZXJu')->data;
>   print URI->new('data:;base64,%51%6D%70%76%5A%58%4A%75')->data;
> 
> I think this should both print "Bjoern", but in the second case the
> module returns garbage (URI 1.35).

Thanks for your report.  I've applied the following patch to fix this
bug:

Index: URI/data.pm
===================================================================
RCS file: /cvsroot/libwww-perl/uri/URI/data.pm,v
retrieving revision 4.4
diff -u -p -r4.4 data.pm
--- URI/data.pm 14 Jan 2004 13:33:44 -0000      4.4
+++ URI/data.pm 19 Apr 2006 11:01:01 -0000
@@ -55,7 +55,8 @@ sub data
        $self->opaque("$enc,$new");
     }
     return unless defined wantarray;
-    return $base64 ? decode_base64($data) : uri_unescape($data);
+    $data = uri_unescape($data);
+    return $base64 ? decode_base64($data) : $data;
 }
 
 # I could not find a better way to interpolate the tr/// chars from
Index: t/data.t
===================================================================
RCS file: /cvsroot/libwww-perl/uri/t/data.t,v
retrieving revision 1.4
diff -u -p -r1.4 data.t
--- t/data.t    5 Aug 2003 15:27:49 -0000       1.4
+++ t/data.t    19 Apr 2006 11:01:01 -0000
@@ -9,7 +9,7 @@ if ($@) {
     exit;
 }
 
-print "1..21\n";
+print "1..22\n";
 
 use URI;
 
@@ -106,3 +106,5 @@ $old = $u->data("new");
 print "not " unless $old eq "" && $u eq "data:bar%2Cb%E5z,new";
 print "ok 21\n";
 
+print "not " unless URI->new('data:;base64,%51%6D%70%76%5A%58%4A%75')->data eq 
"Bjoern";
+print "ok 22\n";

Reply via email to