Subject: | Failure when using an ampersand in track name |
Date: | Sun, 8 Aug 2010 20:22:07 +0200 |
To: | bug-WebService-Audioscrobbler [...] rt.cpan.org |
From: | Jens Gräf <jgraef [...] linetco.com> |
Problem:
Ampersand symbols in track names are not properly escaped.
Error message:
Error while fetching data from
'http://ws.audioscrobbler.com/1.0/track/Stillste%2520Stund/Speichel,%2520Laub%2520&%2520Saitenspiel/toptags.xml
Package:
WebService-Audioscrobbler-0.07
Perl revision:
perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
Liburi-version:
1.52
OS:
Ubuntu Karmic 64bit
2.6.32-24-generic #39-Ubuntu SMP
Minimal Code:
use WebService::Audioscrobbler;
use strict;
use warnings;
my $ws=WebService::Audioscrobbler->new;
my $trackObj=$ws->track("Stillste Stund","Speichel, Laub & Saitenspiel");
my @tags=$trackObj->tags();
Workaround:
Don't use $uri->path_segments() in Base.pm:210
as it seems to unescape the previously escaped ampersand.
Replacing line ~210
$uri->path_segments($uri->path_segments, $postfix);
by
$uri->path($uri->path."/".$postfix) if defined($postfix);
seems to stop the problem, but gluing uris by hand is not the most clean
solution :)