Skip to content

Detect Vorbis Ogg audio MIME type - #95

Open
PHJ2000 wants to merge 2 commits into
j256:mainfrom
PHJ2000:fix/vorbis-ogg-mime-type
Open

PHJ2000 wants to merge 2 commits into
j256:mainfrom
PHJ2000:fix/vorbis-ogg-mime-type

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Nov 6, 2026

Copy link
Copy Markdown

Refs #90.

The bundled magic rules recognize the reported file as Vorbis audio, but inherit application/ogg from the generic Ogg rule. Set audio/ogg on the existing Vorbis continuation, consistent with RFC 5334 section 10.3.

Add ContentType.OGA for the audio MIME type and its associated extensions. Keep the existing extension-only .ogg, .oga and .spx lookups mapped to OGG. Unidentified Ogg, unknown revisions and other codec rules retain their previous behavior. This is a focused Vorbis classification change, not a general multiplexed-Ogg inspection.

The tests use newly constructed identification-page prefixes, with no music file added to the repository. They cover default byte-array and InputStream detection, explicit plaintext rules, MIME metadata, generic/video fallbacks and extension-only lookups. Maven's existing compile step continues to generate the bundled magic.gz from the updated rules.

Validation on Linux with JDK 11.0.32.1:

  • The same seven regression cases compile and run on both versions: base has four failures and three passing controls; the patched version passes all seven.
  • mvn --batch-mode --no-transfer-progress --show-version clean package passes 366 tests, with two existing ignored tests and no failures or errors (368 entries). This is the repository CI build command and includes Javadoc and packaging.
  • A separate probe loads the packaged JAR and reads the actual 530,842-byte issue attachment through the public File API. It returns audio/ogg and OGA. The attachment is retained only as a local diagnostic input.
  • Other JDKs/operating systems and additional Ogg codecs have not been validated locally. The probe is separate from the full test-suite result.

Focused command:

mvn --batch-mode --no-transfer-progress --show-version -Dtest=OggMimeTypeTest test

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.

1 participant