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

disable to force download file uploaded by tus #863

Closed
iammilaad opened this issue Dec 6, 2022 · 2 comments
Closed

disable to force download file uploaded by tus #863

iammilaad opened this issue Dec 6, 2022 · 2 comments

Comments

@iammilaad
Copy link

My upload system with tus wroks perfect but i have a problem with urls of files, when open the url of upload file, that file automatically going to download by browser, how can i handle this flow? just open file in browser without downloading…

@Murderlon
Copy link
Member

Hi, there is nothing we can do about that. The point of the url is that it directly links to the resource. Further more, this is an XY problem. It's unclear what the underlying problem is you're trying to solve.

@Acconut
Copy link
Member

Acconut commented Jan 18, 2023

tusd has a hardcoded list of file types that it will show inline:

// mimeInlineBrowserWhitelist is a map containing MIME types which should be
// allowed to be rendered by browser inline, instead of being forced to be
// downloaded. For example, HTML or SVG files are not allowed, since they may
// contain malicious JavaScript. In a similiar fashion PDF is not on this list
// as their parsers commonly contain vulnerabilities which can be exploited.
// The values of this map does not convey any meaning and are therefore just
// empty structs.
var mimeInlineBrowserWhitelist = map[string]struct{}{
"text/plain": struct{}{},
"image/png": struct{}{},
"image/jpeg": struct{}{},
"image/gif": struct{}{},
"image/bmp": struct{}{},
"image/webp": struct{}{},
"audio/wave": struct{}{},
"audio/wav": struct{}{},
"audio/x-wav": struct{}{},
"audio/x-pn-wav": struct{}{},
"audio/webm": struct{}{},
"video/webm": struct{}{},
"audio/ogg": struct{}{},
"video/ogg": struct{}{},
"application/ogg": struct{}{},
}
Everything else is shown with a download dialog in the browser. tusd is not intended for serving file content, so there is little support for customization here.

@Acconut Acconut closed this as completed Jan 18, 2023
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

No branches or pull requests

3 participants