From 957ed1b5d6d05e8a5ead13f3a601349b0eb8e74e Mon Sep 17 00:00:00 2001 From: Rouzax Date: Tue, 12 May 2026 14:32:26 +0200 Subject: [PATCH] Guard ReplayGain and URL tag processing against arrayrefs Some ID3v2 TXXX-derived tags may arrive as arrayrefs if Audio::Scan returns multi-value frames. Add defensive guards using the established pattern from elsewhere in Schema.pm to take the first element when an arrayref is encountered. Covers: REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_TRACK_PEAK, REPLAYGAIN_ALBUM_GAIN, REPLAYGAIN_ALBUM_PEAK, and URL. Signed-off-by: Rouzax --- Slim/Schema.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Slim/Schema.pm b/Slim/Schema.pm index a04164313d..e50fbed8a2 100644 --- a/Slim/Schema.pm +++ b/Slim/Schema.pm @@ -1305,6 +1305,7 @@ sub _createOrUpdateAlbum { # Bug 8034, this used to not change gain/peak values if they were already set, # bug we do want to update album gain tags if they are changed. if ( $attributes->{$gainTag} ) { + $attributes->{$gainTag} = $attributes->{$gainTag}[0] if ref $attributes->{$gainTag} eq 'ARRAY'; $attributes->{$gainTag} =~ s/\s*dB//gi; $attributes->{$gainTag} =~ s/\s//g; # bug 15965 $attributes->{$gainTag} =~ s/,/\./g; # bug 6900, change comma to period @@ -2802,6 +2803,7 @@ sub _preCheckAttributes { # Bug: 2605 - Get URL out of the attributes - some programs, and # services such as www.allofmp3.com add it. if ($attributes->{'URL'}) { + $attributes->{'URL'} = $attributes->{'URL'}[0] if ref $attributes->{'URL'} eq 'ARRAY'; push @$rawcomments, delete $attributes->{'URL'}; } @@ -2921,6 +2923,7 @@ sub processReplayGainTags { $shortTag =~ s/^REPLAYGAIN_TRACK_(\w+)$/REPLAY_$1/; if (defined $attributes->{$gainTag}) { + $attributes->{$gainTag} = $attributes->{$gainTag}[0] if ref $attributes->{$gainTag} eq 'ARRAY'; $attributes->{$shortTag} = delete $attributes->{$gainTag}; $attributes->{$shortTag} =~ s/\s*dB//gi;