-
Notifications
You must be signed in to change notification settings - Fork 168
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
Wrong Content-Type header for SVG images #354
Comments
Thanks for reporting that. The library we use might be unable to properly detect those files. |
Yup, that's the case |
The funny thing is that mime type is properly set in the DB when upload is created through web GUI (browser sends file type in request body)
However when later actual file is sent the file type gets detected using |
Plik use golang http mime sniffer to resolve content types
https://golang.org/pkg/net/http/#DetectContentType
This is a security measure to avoid possibilities to set fake content-types
( img -> exe ).
The client library may send the fileType as a useful debug info.
#172
Le dim. 1 août 2021 à 21:21, BR ***@***.***> a écrit :
… The funny thing is that mime type is properly set in the DB when upload is
created through web GUI (browser sends file type in request body)
# POST /upload
{"ttl":2592000,"files":[{"fileName":"zabawka.svg","fileType":"image/svg+xml","fileSize":13243,"reference":"0"}]}
However when later actual file is sent the file type gets detected using
net/http.DetectContentType and DB entry is overwritten with wrong fileType
.
(POST /file///zabawkaled.svg)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#354 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQ5XPVQ3DCOPLX4BQAKC23T2WNDJANCNFSM4Z6MKBFQ>
.
|
When serving SVG files plik server sets
Tested on Firefox 86.0.1, invalid content type prevents proper display of transparency and probably more elements of SVG files.
Content type should be set to "image/svg+xml"
https://www.w3.org/TR/SVG11/mimereg.html
The text was updated successfully, but these errors were encountered: