Skip to content

Commit

Permalink
Fix an issue introduced in #1090: utf8::decode('some string') would…
Browse files Browse the repository at this point in the history
… not return the string, but a boolean, whether the conversion has succeeded or not. This lead to a cache key which would match all request, no matter what parameters were sent, as the params were not part of the cache key. This in turn lead to LMS always returning the same number of tracks for eg. an artist's various albums.

Let's use `Slim::Utils::Unicode::utf8on()` instead.
  • Loading branch information
michaelherger committed Jan 7, 2025
1 parent a608de8 commit e3effbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog9.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h2><a name="v9.0.1" id="v9.0.1"></a>Version 9.0.1</h2>
<ul>
<li>Only re-initialize menu settings for connected players - otherwise Analytics considers them "active" due to a prefs change.</li>
<li>Fix display of final "Scan done" message in Material skin.</li>
<li>Fix track count caching in "titles" query.</li>
<li><a href="https://github.com/LMS-Community/slimserver/pull/1235">#1235</a> - Need to utf8Decode album title for new &amp; changed (thanks @darrel-k!)</li>
<li><a href="https://github.com/LMS-Community/slimserver/pull/1237">#1237</a> - Fix create table syntax for MySQL (MariaDB) (thanks @JKDingwall!)</li>
<li><a href="https://github.com/LMS-Community/slimserver/pull/1238">#1238</a> - Merge multiple works per track into one single work (thanks @darrel-k!)</li>
Expand Down
2 changes: 1 addition & 1 deletion Slim/Control/Queries.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6327,7 +6327,7 @@ sub _getTagDataForTracks {
if ( $count_only || (my $limit = $args->{limit}) ) {
# Let the caller worry about the limit values

my $cacheKey = md5_hex($sql . utf8::decode(join( '', @{$p}, @$w )) . (Slim::Utils::Text::ignoreCase($search, 1) || ''));
my $cacheKey = md5_hex($sql . Slim::Utils::Unicode::utf8on(join( ':', @$p, @$w )) . (Slim::Utils::Text::ignoreCase($search, 1) || ''));

# use short lived cache, as we might be dealing with changing data (eg. playcount)
if ( my $cached = $bmfCache{$cacheKey} ) {
Expand Down

0 comments on commit e3effbe

Please sign in to comment.