-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Allow to display embed images/pdfs when SERVE_DIRECT was enabled on MinIO storage #35882
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
base: main
Are you sure you want to change the base?
Conversation
|
As far as I know, this issue is specific to PDF LFS files. The Additionally, have we considered using |
|
What is the expected behavior if we rely on file extension name for LFS type detection and the extension name is wrong? Specifically, will the file content still be displayed correctly? |
For images, wrong mimetype still works. |
It depends on the client. Some like browsers can handle wrong mime type and do another content type detection based on the data. |
|
This is a quick fix for the "View Raw File" on the Web UI, which have the filename in the URL. So it should work. |
|
Why not just exclude |
Will you also remember to exclude |
Just use if mimetype == "application/pdf" || (strings.HasPrefix(mimetype, "image/") && mimetype != "image/svg+xml")We have similar code in other places already so it could be moved to a |
|
Also, what about audio/video files? See gitea/modules/typesniffer/typesniffer.go Lines 80 to 83 in 0ce7d66
|
I don't like it, it doesn't feel safe, I don't want to spend more time on fixing security bugs in the future. If you can fix the security problems when they appear in the future, feel free to make your changes. |
No, I don't want to use it at the moment. There are still more logic after This PR aims to fix the clear problems as it stated. To fix more, the comment keyword |
|
To fully refactor the related code and add more supports, it needs to use the approach from "Fix mime-type detection for HTTP server (#18370)" (and also refactor the existing code, a lot of changes) Then it will introduce much more changes in this PR. I don't think these works need to be in this PR's scope (since this PR's aim is clear) |
Releated issue: #30487