Skip to content

Send content types with static uploads - #10

Merged
batuhan merged 1 commit into
mainfrom
batuhan/send-upload-content-types
Aug 7, 2026
Merged

Send content types with static uploads#10
batuhan merged 1 commit into
mainfrom
batuhan/send-upload-content-types

Conversation

@batuhan

@batuhan batuhan commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • include each exported file media type in the Spacefast manifest
  • send a Content-Type header when upload instructions do not provide one
  • use application/octet-stream for unknown extensions
  • release as 0.5.5

Verification

  • ./bin/test.sh
  • ./bin/test-wordpress.sh
  • live managed upload accepted the previously rejected PNG when sent as image/png

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@batuhan
batuhan merged commit 1cbb22e into main Aug 7, 2026
4 checks passed
@batuhan
batuhan deleted the batuhan/send-upload-content-types branch August 7, 2026 16:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant