Fix mislabeled CAF audio conversions on Linux clients - #845
Open
andydoucet wants to merge 1 commit into
Open
andydoucet wants to merge 1 commit into
andydoucet wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CAF voice-message downloads are converted with
afconvert -f m4af -d aac, which produces AAC audio in an MPEG-4/M4A container. The server nevertheless gives the result a.mp3suffix, changes the MIME type toaudio/mp3, and can produce names such asAudio Message.mp3.mp3.Players that trust the declared type or extension cannot determine the duration or decode the file. BlueBubbles 2.1.1.0 on two Linux clients displayed
0:00 / 0:00and would not play these attachments, although the same files worked with more permissive Windows media handling.This is related to the conversion command discussed in #799, but does not depend on that issue's upload race: successfully converted downloads are consistently mislabeled.
Reproduction evidence
Environment:
For a server-generated file named
Audio Message.caf.mp3and served asaudio/mp3,fileandffprobereported:The Linux client cached it as
Audio Message.mp3.mp3and rendered a zero-length player.Fix
afconvertactually creates..m4aconversion path.audio/mp4.Audio Message.caf.m4ato the client-facing nameAudio Message.m4a, avoiding a doubled extension.This retains the native macOS conversion path and introduces no new runtime dependency.
Validation
git diff --checkpasses.afconvertoutput was inspected with bothfileandffprobeto confirm AAC in an M4A container.tsc --noEmitis currently blocked before source checking by the repository's existingignoreDeprecationsvalue intsconfig.json(TS5103under both the installed compiler and the declared TypeScript 5.5.2).