Skip to content

fix(weave): detect WAV from in-memory buffer when libmagic returns octet-stream - #7018

Merged
zbirenbaum merged 4 commits into
masterfrom
zach/wav-buffer-detection
Jun 3, 2026
Merged

fix(weave): detect WAV from in-memory buffer when libmagic returns octet-stream#7018
zbirenbaum merged 4 commits into
masterfrom
zach/wav-buffer-detection

Conversation

@zbirenbaum

@zbirenbaum zbirenbaum commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Description

  • Fixes: WB-35004

  • Some libmagic builds cannot identify a WAV file when classifying it from an in-memory buffer

  • Returns application/octet-stream, even though magic.from_file on the identical bytes correctly returns audio/x-wav.

  • Because Content frequently detects from buffers, WAV (and Content by extension) detection behaves inconsistently

PR fixes inconsistency by checking the RIFF & WAVE magic bytes directly when from_buffer returns nothing or the generic octet-stream type

Testing

Made sure existing tests pass, this fixes failing tests in other branches

zbirenbaum commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@wandbot-3000

wandbot-3000 Bot commented Jun 1, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

@rgao-coreweave rgao-coreweave left a comment

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.

LGTM

does this need test? how do we test wave files?

@zbirenbaum
zbirenbaum force-pushed the zach/wav-buffer-detection branch from 3f6638c to 336cb5a Compare June 2, 2026 20:30
zbirenbaum and others added 3 commits June 3, 2026 12:09
* feat(weave): use content for attached media

* fix(weave): fix lint errors, update tests for audio/wav mimetype and 4-field MessageTuple

* fix(weave): store message parts in content field, remove parts tuple field

* lint

* feat(weave): upload attach_media content on background threads (#7017)

* feat(weave): upload attach_media content on background threads

* chore(weave): re-trigger CI

* fix string typing
@zbirenbaum
zbirenbaum force-pushed the zach/wav-buffer-detection branch from 336cb5a to 3be5be0 Compare June 3, 2026 19:09
@zbirenbaum
zbirenbaum enabled auto-merge (squash) June 3, 2026 19:10
@zbirenbaum
zbirenbaum disabled auto-merge June 3, 2026 19:19
* chore(weave): normalize wav mimetypes
@zbirenbaum
zbirenbaum enabled auto-merge (squash) June 3, 2026 19:43
@zbirenbaum
zbirenbaum merged commit f2d996b into master Jun 3, 2026
338 of 342 checks passed
@zbirenbaum
zbirenbaum deleted the zach/wav-buffer-detection branch June 3, 2026 20:31
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants