Improper mime type
stidmore opened this issue · 5 comments
I'm pretty sure I have this plugin set up correctly and have created a "Local Folder (protected)" asset volume type to hold internal only assets.
Everything seems to be working correctly, but when I visit any internal asset it is always serving up that file as "text/html" instead of as a PDF file, Zip file, etc. Is there something else I need to set up in the Craft config file or within the plugin itself to serve up files with the correct mime types?
Hi @stidmore
Thank you for your feedback. The mime type of the files is determined by this code
It might be, that the respective mime type specifications are missing in your system.
https://www.yiiframework.com/doc/api/2.0/yii-helpers-basefilehelper#$mimeMagicFile-detail
Thanks for the information - it does seem to be a server issue, but I'm not able to figure out what that is just yet. I'm getting the proper mimeType returned from line 112 of the DefaultController.php file, but when it actually serves up the file the Content-type header is set to text/html. I'll keep troubleshooting on the server side - thanks for pointing me to the code that determines the mime type.
Could you try changing line 123 from Content-type to Content-Type? Maybe this is an issue with the casing in the header.
Could you also check if the content of the file is actually correct or if it is maybe an error message. (try to download a txt file or csv file with some content).
And please also make sure, that thenrespecti e craft cms user has read permissions on the given dirctory.
Closed due to inactivity