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

WP Stateless Elementor - CSS files wrong MIME type #395

Closed
MB-Jan opened this issue Sep 4, 2019 · 5 comments
Closed

WP Stateless Elementor - CSS files wrong MIME type #395

MB-Jan opened this issue Sep 4, 2019 · 5 comments
Assignees
Milestone

Comments

@MB-Jan
Copy link

MB-Jan commented Sep 4, 2019

Hey there,

We are using WP Stateless (2.2.7) with Elementor (2.6.8). CSS files generated by Elementor are correctly being transferred to Google Cloud. Unfortunately, the MIME type is incorrect. It is currently saved with the MIME type
Content-Type: application/octet-stream
which I think needs to be corrected. It appears that browsers are unable to use CSS files with this MIME type properly.
How I checked the MIME type:

A few additional details:

  • WordPress Version 5.2.2
  • PHP 7.2
  • WP Stateless Settings:
    • Mode: Stateless

Please let me know if you need to know anything else. I can send the direct file URL in a message on request.

Thank you.

Best regards,

Jan

@alimuzzaman
Copy link
Contributor

alimuzzaman commented Dec 2, 2019

Hello @MB-Jan,

Sorry for the late replay.

This issue has been solved. Please update to the latest version of WP-Stateless and check again.

Thanks for your awesome detailed issue.

@jimyaghi
Copy link

i dont see that this issue is at all resolved. The problem is in class-sync-non-media.php line 83 $file_type = wp_check_filetype($absolutePath);

The default behaviour of WP is that this function will get a list of allowed upload types and then run through them to find if our file matches one of them. However, the default wordpress has css file uploads disabled and this does not change with elementor being installed. Thus, we get back an empty mime type and the upload goes to GCS with an empty mime which defaults to application/octet-stream and the css files dont work.

@alimuzzaman alimuzzaman self-assigned this Mar 28, 2020
@alimuzzaman alimuzzaman added this to the v2.4.0 milestone Mar 28, 2020
alimuzzaman pushed a commit that referenced this issue Mar 28, 2020
WP Stateless Elementor - CSS files wrong MIME type #395
@MB-Jan
Copy link
Author

MB-Jan commented Mar 29, 2020

@alimuzzaman: I can confirm what @jimyaghi wrote. Can you please fix the issue.

@jimyaghi
Copy link

@alimuzzaman thank you for being so quick to take care of it. I would really appreciate however if we don't add more libraries unnecessarily to solve the issue. Please see:

https://github.com/wpCloud/wp-stateless/blob/a93638abe0d2ae5013e0c7f6f7155e8e101c0c33/lib/Google/vendor/guzzlehttp/psr7/src/functions.php#L620

This is already included in your plugin, why not use it? It works off the official apache recognised list of mime types and is a simple enough routine to extract and write on your own if you prefer to decouple from another library's dependencies.

Thanks for being a good sport :)

@alimuzzaman
Copy link
Contributor

@jimyaghi I have copied the function to our class, as the Google library isn't autoloaded (only loaded when syncing media).

Thanks

@planv planv closed this as completed Mar 30, 2020
@ewsopp ewsopp removed this from the v2.4.0 milestone Jun 3, 2020
@ewsopp ewsopp added this to the v3.0.0 milestone Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants