Skip to content

Guard ReplayGain and URL tag processing against arrayrefs#1571

Merged
michaelherger merged 1 commit into
LMS-Community:public/9.2from
Rouzax:fix/schema-arrayref-guards
May 13, 2026
Merged

Guard ReplayGain and URL tag processing against arrayrefs#1571
michaelherger merged 1 commit into
LMS-Community:public/9.2from
Rouzax:fix/schema-arrayref-guards

Conversation

@Rouzax
Copy link
Copy Markdown
Contributor

@Rouzax Rouzax commented May 12, 2026

Summary

  • Add defensive guards in Schema.pm for three code paths that apply regex to TXXX-derived tag values
  • Uses the established $val = $val->[0] if ref $val eq 'ARRAY' pattern already present in Schema.pm
  • Covers: ReplayGain track gain/peak, album gain/peak, and URL/comments

Context

Companion to the Audio::Scan multi-value TXXX fix (LMS-Community/Audio-Scan#11). These guards are independently useful as defensive hygiene: they protect against arrayrefs arriving in these paths regardless of source.

Forum discussion: https://forums.lyrion.org/forum/user-forums/ripping-encoding-transcoding-tagging/1816764-lms-metadata-scaan-overrides-local-tags

Test plan

  • smoketest passes (t/00_smoketest.sh)
  • Manual: scan MP3 files with ReplayGain TXXX tags, verify gain values still parse correctly

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 <GitHub@mgdn.nl>
Copy link
Copy Markdown
Member

@michaelherger michaelherger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@michaelherger michaelherger merged commit 9a61bb0 into LMS-Community:public/9.2 May 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants