Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the URI-Find CPAN distribution.

Report information
The Basics
Id: 84510
Status: open
Priority: 0/
Queue: URI-Find

People
Owner: Nobody in particular
Requestors: JGMYERS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 20111103
Fixed in: (no value)



Subject: URI::Find corrupts input
The attached test case demonstrates URI::Find corrupting its input string.
Subject: uue.t
use Test::More qw(no_plan); use URI::Find; my $txt = << 'EOF' ; begin 644 mem.txt M("`@("`@("`@("`@("`@("`@("`@("`@("`@('P@(#0Q,34Q,SD@?"`@(#$V M,#<T+C<V(`H@("`@($ME<FYE;"!I9&5N=&EF:65D(&UE;6]R>2`H<V5G:61S M+'=L;5]H=U]P86=E<RD@?"`@,30W,S8X,2!\("`@(#4W-38N-38@"B`@("`@ M2V5R;F5L('5N+6ED96YT:69I960@;65M;W)Y("`@("`@("`@("`@("`@("`@ M("!\("`@(#$U-30P('P@("`@("`V,"XW,"`*("`@("!&;W)K('1R964@<&%G M97,@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@('P@("`@(#4U-C<@ M?"`@("`@(#(Q+C<T(`H@("`@($QA<F=E(%!A9V4@4&]O;"!F<F5E('!A9V5S M("`@("`@("`@("`@("`@("`@("`@?"`@("`@("`@,"!\("`@("`@(#`N,#`@ M"B`@("`@2'5G92!086=E(%!O;VP@9G)E92!P86=E<R`@("`@("`@("`@("`@ M("`@("`@("!\("`@("`@("`P('P@("`@("`@,"XP,"`*("`@("!5<V5R('!R M:79A=&4@;65M;W)Y("`@("`@("`@("`@("`@("`@("`@("`@("`@('P@(#$U M,34W-C8@?"`@("`U.3(P+CDV(`H@("`@(%5S97(@<VAA<F5D(&UE;6]R>2`@ M("`@("`@("`@("`@("`@("`@("`@("`@("`@?"`@(#<Y,C4P,B!\("`@(#,P ` end EOF my $expected = $txt; my $finder = URI::Find->new(sub { die; }); $finder->find(\$txt); is($txt, $expected);
Possible fix attached. I don't know the consequences of passing a URI that still has whitespace into _uri_filter().
Subject: URI-Find-20111103-whitespace.patch
Index: lib/URI/Find.pm --- opt/perl/lib/site_perl/5.8.8/URI/Find.pm~ 2013-02-13 19:32:39.000000000 -0800 +++ opt/perl/lib/site_perl/5.8.8/URI/Find.pm 2013-04-08 16:04:54.000000000 -0700 @@ -147,7 +147,7 @@ if( $is_uri ) { $replace .= $escape_func->($2); - $replace .= $self->_uri_filter($maybe_uri); + $replace .= $self->_uri_filter($3); $replace .= $escape_func->($4); } else {
Thanks for the report and the patch.

Your bug is definitely a bug.  Since you passed in no replacement function the original text should remain unaltered.

That patch breaks t/rfc3986_appendix.t which checks that a URI with a newline in it has the newline stripped out.  Not sure why.