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

opus files are downloaded as octet-stream #1194

Closed
masewo opened this issue Sep 25, 2024 · 4 comments · Fixed by #1253
Closed

opus files are downloaded as octet-stream #1194

masewo opened this issue Sep 25, 2024 · 4 comments · Fixed by #1253
Labels

Comments

@masewo
Copy link
Contributor

masewo commented Sep 25, 2024

Describe the bug
Files with content type audio/ogg; codecs=opus are downloaded as application/octet-stream.
The content type does not pass the regex check in the unrounted_handler.go.

To Reproduce
Steps to reproduce the behavior:

  1. Upload an opus file
  2. Download this file
  3. See content type

Expected behavior
The content type is audio/ogg; codecs=opus.

Setup details
Please provide following details, if applicable to your situation:

  • Operating System: Windows
  • Used tusd version: 2.5.0
  • Used tusd data storage: disk store
  • Used tusd configuration: Go
  • Used tus client library: Uppy.js
@masewo masewo added the bug label Sep 25, 2024
@Acconut
Copy link
Member

Acconut commented Sep 26, 2024

That's correct. Additional parameters in the media type are currently not allowed. Would you be interested in a PR for extending the regular expression to allow the syntax specified in https://httpwg.org/specs/rfc9110.html#media.type?

Alternatively, we could also consider moving away from the regular expression entirely and instead use Go's builtin media type parser: https://pkg.go.dev/mime#ParseMediaType. The benefit is that we do not have to maintain a complex regular expression that might be incompatible with the actual specs.

If the parsing fails, we would use application/octet-stream. Otherwise, we set Content-Disposition depending on whether the media type is allowed to be displayed inline or not.

What do you think?

@masewo
Copy link
Contributor Author

masewo commented Mar 7, 2025

Thank you @Acconut for your reference to tus/tus-node-server#655

I did not have good experiences recently with go's built-in mime package since it relies on information of the OS where it is installed on (causing issue for me on Alpine systems).

I opened a pull request that mimics the TypeScript implementation: #1253

@Acconut
Copy link
Member

Acconut commented Mar 7, 2025

I did not have good experiences recently with go's built-in mime package since it relies on information of the OS where it is installed on (causing issue for me on Alpine systems).

That's surprising to me as I would expect media parsing to not load OS resources since it's just parsing a string. However, I haven't tested this on my own yet. Nevertheless, I would like to explore that route more as I also mentioned in a comment in your PR.

@Acconut Acconut linked a pull request Mar 10, 2025 that will close this issue
@Acconut
Copy link
Member

Acconut commented Mar 10, 2025

Fixed in #1253.

@Acconut Acconut closed this as completed Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants