Repository navigation
fix(links): decode base64url dialog audio in the whisper links - #208
Merged
Merged
Conversation
draft-ietf-vcon-vcon-core-04 allows base64url, json or none as dialog encoding, and telephony adapters are moving to unpadded base64url for inline audio. Plain base64.b64decode either raises on the missing padding or, in its default non-validating mode, silently drops "-"/"_" and returns corrupted audio instead of raising. decode_inline_dialog_body() dispatches on the dialog's own encoding: base64url (with or without padding) via a validated decode, legacy base64/missing encoding for vCons stored before encoding was mandatory, and a clear ValueError for "none" or anything unrecognized rather than guessing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
groq_whisper and hugging_face_whisper decoded inline dialog audio with plain base64.b64decode(dialog["body"]) regardless of the dialog's encoding field, which corrupts or rejects unpadded base64url bodies from adapters moving to that encoding. wtf_transcribe already branched on encoding == "base64url" but used a non-validating, unpadded urlsafe_b64decode that has the same failure mode. Switch all three to common/lib/dialog_body.decode_inline_dialog_body(), which validates and pads as needed. URL-referenced (non-inline) dialogs are unchanged in all three links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous non-validating decode skipped line breaks, so MIME-style bodies wrapped at 76 columns decoded. Strip whitespace before the validating decode so those keep working; other stray characters still fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The Groq and Hugging Face whisper links decoded inline dialog audio with plain
base64.b64decode()whatever the dialog'sencodingsaid. vCon core draft-04 allows onlybase64url,jsonornoneforencoding, and producers are moving inline audio to unpaddedbase64url. On that input the old code either raised on the missing padding or, becauseb64decodedoes not validate by default, silently dropped-and_and returned corrupted audio that was then transcribed.Changes
common/lib/dialog_body.py:decode_inline_dialog_body(dialog) -> bytesdecodes byencoding.base64url: padding restored, then a validating decode.base64.urlsafe_b64decodeis not used because it also skips validation.base64, or noencoding(vCons stored before the field was required): validating standard decode.none, any other value, or invalid characters:ValueError, never a guess.groq_whisper,hugging_face_whisperandwtf_transcribeuse the helper.wtf_transcribealready branched onbase64urlbut calledurlsafe_b64decodewithout restoring padding, so it raised on unpadded bodies; fixed by the same change.b64decodesites were checked and left alone: SCITT key material and signing keys are not dialog bodies.common/vcon.py's write-time base64url validation does not restore padding either; noted, out of scope here.Tests
common/tests/lib/test_dialog_body.py: unpadded and padded base64url, legacy base64, missing encoding, bytes that encode to-and_(asserting plainb64decodecorrupts them and the helper does not), line-wrapped bodies, and every error path.uv run pyteston the touched modules: 35 passed, 4 skipped (API-key and network gated), against 26 passed on main. The wider non-Docker suite: 684 passed, 20 skipped. The Redis-backed modules CI runs inside Docker were not run locally.Refs CON-1112
🤖 Generated with Claude Code