Skip to content

FIX: Audio files content check bug#1579

Open
jbolor21 wants to merge 3 commits intomicrosoft:mainfrom
jbolor21:users/bjagdagdorj/realtime_gui
Open

FIX: Audio files content check bug#1579
jbolor21 wants to merge 3 commits intomicrosoft:mainfrom
jbolor21:users/bjagdagdorj/realtime_gui

Conversation

@jbolor21
Copy link
Copy Markdown
Contributor

@jbolor21 jbolor21 commented Apr 8, 2026

Description

Sending audio files ie via Realtime is failing with the GUI because the whole base64 is being read by Path(piece.original_value).is_file(), which treats the whole string as a potential filename, which obviously is too long and thus errors out.
As a fix, this adds two guards:

  1. Length check (< 4096) — no real filesystem path is that long, so skip the check for base64 data
  2. try/except OSError — catch any remaining edge cases where the OS rejects the path

This lets the base64 audio data flow through to the serializer where it gets properly decoded and saved as a .wav file.

Tests and Documentation

Tested manually via UI and reran all tests and added new unit test

@jbolor21 jbolor21 marked this pull request as draft April 8, 2026 20:15
@jbolor21 jbolor21 changed the title [DRAFT] FIX: Realtime GUI bug FIX: Realtime GUI bug Apr 8, 2026
@jbolor21 jbolor21 marked this pull request as ready for review April 8, 2026 20:27
@jbolor21 jbolor21 changed the title FIX: Realtime GUI bug FIX: Audio files content check bug Apr 8, 2026

# Already an existing file on disk — keep as-is
if Path(piece.original_value).is_file():
# Already an existing file on disk — keep as-is.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think the length check is unnecessary, and also I suggest you don't need to the extra variable is_existing_file, which is set in the try/catch block and used [only] right after it. instead, this might be more readable:

(basically just add a try: <current-code> except (OSError): <pass>

try:
    if Path(piece.original_value).is_file():
        if piece.converted_value is None:
            piece.converted_value = piece.original_value
        continue
except (OSError, ValueError):
    pass

This will take care of cases where the content is indeed resolvable to a file, and pass over it when it's not.

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