Closed stingmu closed 6 years ago
same problem here
I see, thank you. Will have a look.
Hm, I'm having a hard time to reproduce this, I get the correct content type.
➜ ~ curl -I 'http://localhost/CRUDlexSample/web/crud/resource/static?file=css/vendor/select2/select2.min.css' HTTP/1.1 200 OK Date: Fri, 24 Nov 2017 09:27:21 GMT Server: Apache/2.4.25 (Unix) PHP/7.1.0 Last-Modified: Tue, 13 Sep 2016 21:06:39 GMT ETag: "3b5c-53c69fd1815c0" Accept-Ranges: bytes Content-Length: 15196 Content-Type: text/css
Do you have any URL or minimum example where this happens?
Hello, First, philiplbb thanks for you work, that's awesome!
Same problem here
curl -I 'https://localhost/bo/crud/resource/static?file=css/vendor/select2/select2.min.css' HTTP/1.0 200 OK Date: Mon, 27 Nov 2017 06:16:08 GMT Server: Apache/2.4.10 (Debian) Content-Disposition: attachment; filename="select2.min.css" Content-Length: 15196 Cache-Control: public ETag: "1503435368" Vary: Accept-Encoding Connection: close Content-Type: text/plain;charset=UTF-8
Give in navigator an unstyled result without javascript too.
product:13 Resource interpreted as Stylesheet but transferred with MIME type text/plain: "https://localhost/bo/crud/resource/static?file=css/vendor/select2/select2-bootstrap.min.css".
Think "$filesystem->getMimetype(basename($file))" l604 of ControllerProvider get bad result. But don't know why.
For example, with the file vendor/philiplb/crudlex/src/CRUDlex/../static/css/vendor/bootstrap/bootstrap.min.css :
No definitive solution for the moment because the problem is so strange. But If i replace mimeType at line 612 of ControllerProvider by text/css, that work fine.
Thanks for the detailed description and debugging. :) Flysystem uses finfo_file for detecting the mimetype. http://php.net/manual/de/function.finfo-file.php . Accordingly to http://php.net/manual/de/function.finfo-file.php , this requires PECL fileinfo >= 0.1.0. Is that available on your system? Else, I'm thinking about falling back to the old mechanism of guessing the mimetype in this endpoint by extension. This should be sure as it is static. Maybe generating a hard coded mapping would do it as well.
I have file info 1.0.5 on my Mac and face the same issue. Any other idea? Thanks.
(Finally) fixed via https://github.com/philiplb/CRUDlex/commit/ffd60cee12b7a85999b42a44a54a13bcc8e97a7b Just comment if this doesn't fix it for you. 0.13.0 will be released shortly having this fix.
0.13.0 is released, containing the fix.
Since CRUDlex version 0.12.0 all static files (css,js,...) - get mimetype "text/plain" and GoogleChrome/Firefox show warnings in console. Apache mimetypes - is ok, PHP fileinfo extension - installed. Screenshot ver. 0.12.0 Screenshot ver. 0.11.0 How can I resolve this bug to use CRUDlex with valid CSS and JS? Thank you very much! P.S. Sorry for my english)