Permalink
Browse files

Fixes #2; Widget doesn't work with & symbols

We weren't escaping the special characters in the URL before requesting that URL from Last.fm. So Simon & Garfunkel didn't work for example.

Somewhat embarassed about this mistake…!
  • Loading branch information...
mxcl committed Nov 15, 2009
1 parent 09f2ea8 commit bef1c3aa971f4711e58bfea9a27dc5c947d99203
Showing with 1 addition and 1 deletion.
  1. +1 −1 Last.fm.wdgt/main.js
View
@@ -52,7 +52,7 @@ function set_artist(scpt)
$('text').style.display = 'none';
}
else if ($('artist').innerText != artist) {
- var url = "http://ws.audioscrobbler.com/2.0/?callback=artist_got_info&method=artist.getinfo&api_key=b25b959554ed76058ac220b7b2e0a026&artist="+artist+"&format=json";
+ var url = "http://ws.audioscrobbler.com/2.0/?callback=artist_got_info&method=artist.getinfo&api_key=b25b959554ed76058ac220b7b2e0a026&artist="+encodeURIComponent(artist)+"&format=json";
var script = document.createElement("script");
script.setAttribute("src", url);
script.setAttribute("type", "text/javascript");

0 comments on commit bef1c3a

Please sign in to comment.