Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Consider using audio/mp4 instead of audio/x-m4a for .m4a extension files #3496

Closed
tsmethurst opened this issue Oct 28, 2024 · 2 comments · Fixed by #3506
Closed

[chore] Consider using audio/mp4 instead of audio/x-m4a for .m4a extension files #3496

tsmethurst opened this issue Oct 28, 2024 · 2 comments · Fixed by #3506

Comments

@tsmethurst
Copy link
Contributor

Right now we use the x-m4a extension MIME type, but I think audio/mp4 might cause a bit less confusion for browsers and other fedi servers.

Reference: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#browser_compatibility

@tsmethurst
Copy link
Contributor Author

tsmethurst commented Oct 28, 2024

Oh, I sort of see what's happening, so we rely on this file: https://raw.githubusercontent.com/micnic/mime.json/master/index.json for the MIME types, which comes from here: https://github.com/micnic/mime.json, which flattens it into a simple key/value list using the code here: https://github.com/micnic/mime.json/blob/43e72375273ae9d105b733e96a8f71ee3d51d025/build.mjs#L15-L37. All of that originates from the fuller list in a different repo here: https://raw.githubusercontent.com/jshttp/mime-db/refs/heads/master/db.json

From what I can tell then it's basically an accident that we end up with x-m4a because the micnic build code mentioned above just takes the last value in the source json from jshttp/mime-db, which happens to be nginx's audio/x-m4a, and uses that as the only value in the resulting key/value list. The arguably more correct IANA version earlier in the jshttp/mime-db list (audio/mp4) gets overwritten.

I think to fix this, we might want to redo the code generation in gruf/go-mimetypes to draw from https://raw.githubusercontent.com/jshttp/mime-db/refs/heads/master/db.json instead, and prefer (in order) IANA, then Apache, then Nginx when assembling a canonical list of mime types to file extensions.

@tsmethurst
Copy link
Contributor Author

V. not urgent though, just to clarify -- it's not causing any immediate big problems afaict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant