Skip to content

[WIP] Fix VorbisComment tag handling for FLAC files - #10

Closed
decriptor with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-flac-vorbiscomment-tag-issue
Closed

decriptor with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-flac-vorbiscomment-tag-issue

Conversation

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>FLAC set the VorbisComment as tag incorrectly</issue_title>
<issue_description>

return MediaFileResult.Success (result.File!, result.File!.VorbisComment, MediaFormat.Flac);

VorbisComment is being used as tag and cause the issue.
For example, for flac file, property Pictures contains 1 element in the MediaFileResult.File but not in the MediaFileResult.Tag</issue_description>

<agent_instructions>Create a fix and unit tests for this issue</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@codecov

codecov Bot commented Feb 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.23%. Comparing base (527b7fb) to head (57763b7).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #10   +/-   ##
=======================================
  Coverage   83.23%   83.23%           
=======================================
  Files          95       95           
  Lines       12362    12362           
  Branches     2549     2549           
=======================================
  Hits        10289    10289           
  Misses       1257     1257           
  Partials      816      816           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@decriptor decriptor closed this Feb 9, 2026
decriptor added a commit that referenced this pull request Nov 14, 2026
v003 #1: a v2.4 Year write keeps a TDRC timestamp that already starts with that four-digit year, and an invalid value leaves the frame. v2.3 TYER still stores four digits. TDOR/TORY use the same invalid-value rule.

v003 #2, #4, #10: a compressed frame that does not inflate is skipped instead of parsed as text. The zlib read stays inside the declared size and the 16 MiB cap, returns that buffer when the read fills it, and no longer catches OutOfMemoryException.

v003 #3, #7: COMM descriptions that start with "iTun" are not the comment.

v003 #6: year and genre numbers reject a leading sign and surrounding spaces.

v003 #8: the syncsafe reader doc comment is back on ReadSyncsafeInt32.

v003 #9: HasExtendedHeader is true only for v2.3 and v2.4. v2.2 uses that bit for compression.

Not v003 #5: a v2.4 header unsynchronisation flag is not whole-tag unsync. That contradicts id3v2.4.0-changes and the earlier fix.
decriptor added a commit that referenced this pull request Nov 14, 2026
#1 Copy original bext bytes only for the instance Read parsed.
#2 Walk chunk ckSize in long so a size near int.MaxValue does not throw.
#3 Write the RIFF form size from rendered chunk bytes, not a declared DataSize.
#4 Keep a Latin-1 bext description and a coding history with no trailing CRLF on a title-only save.
#5 AddChunk copied chunks so a second JUNK, data, or fact chunk is kept.
#6 A cleared UMID is not copied back, including when the source version at offset 346 is below 1.
#8 0xFFFFFFFF is one size calculation: a streamed-writer placeholder. RF64 is unsupported.
#9 Keep a second LIST INFO and rewrite only the INFO list this file parsed.
#10 Assigning new BextTag() or new Id3v2Tag() replaces an unparsed chunk. Null still keeps it.
decriptor added a commit that referenced this pull request Nov 14, 2026
v003 #1: Sweep only .taglib_ plus 32 hex digits plus .tmp. Never delete a
legacy temp when its destination is missing. A kept temp is renamed to
<dest>.taglib-recovered and that path is reported.

v003 #2: Sweep a directory at most once per hour, using the .taglib_*.tmp
search pattern, before the write. WriteAsync does not scan again inside
the interval.

v003 #3: Create and flush a symlink temp in the resolved target directory
before replace. A second volume was not mounted; same-volume
cross-directory and same-directory targets are covered.

v003 #4 #5 #6 #8 #9 #10 #11: 23h is kept and 25h is deleted, a failed
replace restores a temp moved beside the target, the public WriteAllBytes
path flushes, an unwritable target directory leaves the link unchanged,
Unix mode code is guarded with OperatingSystem.IsWindows() == false,
owner/group/xattrs are not preserved, async write is ordered before move,
the kept-temp error includes the original message and recovered path once
each, and a sweep fault returns FileWriteResult.Failure.
decriptor added a commit that referenced this pull request Nov 16, 2026
#1 Copy original bext bytes only for the instance Read parsed.
#2 Walk chunk ckSize in long so a size near int.MaxValue does not throw.
#3 Write the RIFF form size from rendered chunk bytes, not a declared DataSize.
#4 Keep a Latin-1 bext description and a coding history with no trailing CRLF on a title-only save.
#5 AddChunk copied chunks so a second JUNK, data, or fact chunk is kept.
#6 A cleared UMID is not copied back, including when the source version at offset 346 is below 1.
#8 0xFFFFFFFF is one size calculation: a streamed-writer placeholder. RF64 is unsupported.
#9 Keep a second LIST INFO and rewrite only the INFO list this file parsed.
#10 Assigning new BextTag() or new Id3v2Tag() replaces an unparsed chunk. Null still keeps it.
decriptor added a commit that referenced this pull request Nov 16, 2026
v003 #1: Sweep only .taglib_ plus 32 hex digits plus .tmp. Never delete a
legacy temp when its destination is missing. A kept temp is renamed to
<dest>.taglib-recovered and that path is reported.

v003 #2: Sweep a directory at most once per hour, using the .taglib_*.tmp
search pattern, before the write. WriteAsync does not scan again inside
the interval.

v003 #3: Create and flush a symlink temp in the resolved target directory
before replace. A second volume was not mounted; same-volume
cross-directory and same-directory targets are covered.

v003 #4 #5 #6 #8 #9 #10 #11: 23h is kept and 25h is deleted, a failed
replace restores a temp moved beside the target, the public WriteAllBytes
path flushes, an unwritable target directory leaves the link unchanged,
Unix mode code is guarded with OperatingSystem.IsWindows() == false,
owner/group/xattrs are not preserved, async write is ordered before move,
the kept-temp error includes the original message and recovered path once
each, and a sweep fault returns FileWriteResult.Failure.
decriptor added a commit that referenced this pull request Nov 16, 2026
v003 #1: a v2.4 Year write keeps a TDRC timestamp that already starts with that four-digit year, and an invalid value leaves the frame. v2.3 TYER still stores four digits. TDOR/TORY use the same invalid-value rule.

v003 #2, #4, #10: a compressed frame that does not inflate is skipped instead of parsed as text. The zlib read stays inside the declared size and the 16 MiB cap, returns that buffer when the read fills it, and no longer catches OutOfMemoryException.

v003 #3, #7: COMM descriptions that start with "iTun" are not the comment.

v003 #6: year and genre numbers reject a leading sign and surrounding spaces.

v003 #8: the syncsafe reader doc comment is back on ReadSyncsafeInt32.

v003 #9: HasExtendedHeader is true only for v2.3 and v2.4. v2.2 uses that bit for compression.

Not v003 #5: a v2.4 header unsynchronisation flag is not whole-tag unsync. That contradicts id3v2.4.0-changes and the earlier fix.
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.

FLAC set the VorbisComment as tag incorrectly

2 participants