Bugzilla – Bug 16441
XMLBrowser search - does not escape utf8 strings in url correctly
Last modified: 2011-03-16 04:47:13 UTC
Noticed this with my spotify plugin - xmlbrowser will make requests which don't correctly escape utf8 strings in search params. Not sure where it is best to call URI::Escape::uri_escape_utf8 hence recording here. Alan - assuming you may want to check this as you have been looking at xmlbrowser recently.
I think we need something like: Index: Slim/Web/XMLBrowser.pm =================================================================== --- Slim/Web/XMLBrowser.pm (revision 31149) +++ Slim/Web/XMLBrowser.pm (working copy) @@ -294,7 +294,7 @@ # Rewrite the URL if it was a search request if ( $subFeed->{'type'} eq 'search' && ( $stash->{'q'} || $searchQuery ) ) { - my $search = $stash->{'q'} || $searchQuery; + my $search = URI::Escape::uri_escape_utf8($stash->{'q'} || $searchQuery); $subFeed->{'url'} =~ s/{QUERY}/$search/g; } This is in addition to escaping the breadcrumb - we need to ensure we send the correct search terms to the http server and this means escaping them.
Andy - do you agree with this patch? Several people have been complaining about this with my spotify plugin and I want to fix it. There doesn't seem to be any more work going on with onebrowser, so I would like to fix 7.6 (and possibly 7.5 if you are planning another release)
Yes patch is fine, thanks!
== Auto-comment from SVN commit #31445 to the slim repo by adrian == == http://svn.slimdevices.com/slim?view=revision&revision=31445 == Bug: 16441 Description: uri escape search strings in xmlbrowser
Is this fixed now?
This is working in onebrowse, but the breadcrumb for unicode searches loses the encoding when you browse into the search item. I think this fixes it - if you agree should be in 7.6 and onebrowse (ideally 7.5 too if there is any more life in this!) --- Slim/Web/XMLBrowser.pm (revision 31902) +++ Slim/Web/XMLBrowser.pm (working copy) @@ -279,6 +279,7 @@ } elsif ( $i =~ /(?:\d+)?_(.+)/ ) { $searchQuery = uri_unescape($1); + Slim::Utils::Unicode::utf8on($searchQuery); } # Add search query to crumbName
Yes, I think that Slim::Utils::Unicode::utf8on() should always be considered as a candidate to be called on the results of uri_unescape, if there is any chance that the unescaped string may contain UTF-8.
== Auto-comment from SVN commit #31903 to the slim repo by ayoung == == http://svn.slimdevices.com/slim?view=revision&revision=31903 == bug 16441: XMLBrowser search - does not escape utf8 strings in url correctly Set UTF8 flag after unescaping.
It seems to work ok for me in 7.6 trunk. Adrian, do you still see any problems there?
Yes - same case works ok in 7.6, lets call this closed. Thanks.