app: don't fail audio export when one WAV part is corrupt (missing RIFF)#9335
Open
mdmohsin7 wants to merge 2 commits into
Open
app: don't fail audio export when one WAV part is corrupt (missing RIFF)#9335mdmohsin7 wants to merge 2 commits into
mdmohsin7 wants to merge 2 commits into
Conversation
A single part that isn't a valid WAV (e.g. a stale/mislabeled artifact) threw 'Invalid WAV file: missing RIFF header' and failed the entire multi-part audio share. Skip unparseable parts and combine the ones that do parse; only fail when none are valid.
kodjima33
approved these changes
Jul 10, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Mobile bug fix: skip corrupt WAV part in multi-part export instead of hard-failing; has test. Approve (Android Compile Smoke red blocks merge).
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
Sharing a multi-part WAV conversation could fail entirely with:
WavCombiner.combineWavFilesparsed every part up front and threw on the first one that wasn't a canonical WAV, aborting the whole export — the user got "failed to download audio" instead of their recording.The backend serves canonical
pcm_to_wavWAVs, so this is a bad/stale/mislabeled part slipping through; regardless of the exact cause, one bad part shouldn't nuke the entire share.Scope / data
sharePositionOriginbug fixed in app: fix iOS 'failed to download audio' (missing sharePositionOrigin) #9334), current app versions.Fix
combineWavFilesnow parses each part in a try/catch, skips any that don't parse as valid WAV (logging which), and combines the rest. It only throws when no part is valid. This mirrors the existing "degrade gracefully rather than produce a corrupt file / hard-fail" behavior already in the download service's mixed-format branch.Tests
test/utils/wav_combiner_test.dart(4 cases): combine valid parts; skip a missing-RIFF part and combine the rest; return the lone valid part when the others are corrupt; throw only when none are valid. All pass.Verification
flutter analyze: no errors/warnings.flutter test test/utils/wav_combiner_test.dart: 4/4 pass.