Skip to content

Conversation

@earl-warren
Copy link
Contributor

  • OGG is officially an container format and is therefor classified as application/ogg in RFC3534. While audio/ogg exists, as defined in RFC5334, it doesn't have a different magic number and thus purely informative, it can only be determined by parsing the file and checking if it only contains audio data.
  • A quick search on Wikimedia Commons yields that the OGG container is by far more used for audio than for video, so it's safe to classify this as audio, as OGG files that only contain video would now falsy be classified as an audio file (previously it would've shown just a link to the 'View Raw' link).
  • Added unit tests.
  • Resolves https://codeberg.org/forgejo/forgejo/issues/1091

(cherry picked from commit f5fa1a245236527dd41af4e71b5486c1a39e898a)

- OGG is officially an container format and is therefor classified as
`application/ogg` in RFC3534. While `audio/ogg` exists, as defined in
RFC5334, it doesn't have a different magic number and thus purely
informative, it can only be determined by parsing the file and checking
if it only contains audio data.
- A quick search on Wikimedia Commons yields that the OGG container is
by far more used for audio than for video, so it's safe to classify this
as audio, as OGG files that only contain video would now falsy be
classified as an audio file (previously it would've shown just a link to
the 'View Raw' link).
- Added unit tests.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1091

(cherry picked from commit f5fa1a245236527dd41af4e71b5486c1a39e898a)
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 14, 2023
@wxiaoguang
Copy link
Contributor

This assumption is not right

https://en.wikipedia.org/wiki/Ogg

The Ogg container format can multiplex a number of independent streams for audio, video, text (such as subtitles), and metadata.

@lunny
Copy link
Member

lunny commented Aug 14, 2023

This assumption is not right

https://en.wikipedia.org/wiki/Ogg

The Ogg container format can multiplex a number of independent streams for audio, video, text (such as subtitles), and metadata.

The extension name is .ogx for application/ogg? Maybe RFC 3534 has been obsoleted by RFC 5334 so we don't need to support application/ogg

In May 2003, two Internet RFCs were published relating to the format. The Ogg bitstream was defined in RFC 3533 (which is classified as 'informative') and its Internet content type (application/ogg) in RFC 3534 (which is, as of 2006, a proposed standard protocol). In September 2008, RFC 3534 was obsoleted by RFC 5334, which added content types video/ogg, audio/ogg and filename extensions .ogx, .ogv, .oga, .spx.

@wxiaoguang
Copy link
Contributor

-> Detect ogg mime-type as audio or video #26494

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants