Send content types with static uploads - #10
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e73dcad4f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| public static function content_type_for_file( string $file_path ): string { | ||
| $filetype = wp_check_filetype( $file_path ); |
There was a problem hiding this comment.
Avoid capability-filtered MIME lookup for exported assets
When automatic publishing runs through WP-Cron or Simply Static's background queue, there is no authenticated user, so wp_check_filetype() defaults to get_allowed_mime_types(), which excludes HTML and JavaScript for users without unfiltered_html and may be further restricted by upload_mimes. Normal index.html and .js files will therefore be declared and uploaded as application/octet-stream, potentially making pages download and causing browsers to reject scripts. Use an unfiltered MIME map such as wp_get_mime_types() or another lookup independent of upload permissions.
Useful? React with 👍 / 👎.
Summary
Verification
./bin/test.sh./bin/test-wordpress.shimage/pngNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.