Skip to content

Media: Keep one list of the image formats the upload pipeline takes. - #67

Merged
adamsilverstein merged 1 commit into
fix/csm-classic-non-image-uploadsfrom
fix/csm-dedupe-pipeline-image-types
Nov 5, 2026
Merged

adamsilverstein merged 1 commit into
fix/csm-classic-non-image-uploadsfrom
fix/csm-dedupe-pipeline-image-types

Conversation

@adamsilverstein

Copy link
Copy Markdown
Owner

Follow up to the hard coding review comment on WordPress#15512 - targets that PR's branch so it can be merged in there.

Claude made the change, notes below:

The image formats the pipeline takes were listed twice in core: the new isPipelineFile() check in media-upload-pipeline.js, and the placeholder tile typing in media-frame-upload.js. Both now read one IMAGE_SUBTYPES list in media-upload-pipeline.js. The media frame gets it through a new wp.mediaUploadPipeline.getImageSubtype( fileName ), which also does the jpg to jpeg mapping.

The list carries a comment pointing at CLIENT_SIDE_SUPPORTED_MIME_TYPES and HEIC_MIME_TYPES in @wordpress/upload-media, the list it mirrors. Removing that last copy needs upload-media to export the list or an "is this processable" helper, which is a Gutenberg change and left for a follow up.

One small behavior change: the placeholder typing now matches the file extension after the last dot, where the old regex matched the end of the name, so a file named notajpg no longer gets an image placeholder. Routing is unchanged.

Testing

  • media-library, media-new and media-modal client-side upload e2e specs pass locally (41 tests).
  • jshint and npm run typecheck:js are clean.

Manually: in a media frame, upload a JPEG (.jpg) and a PNG and check the placeholder tiles show as images while uploading, then upload a PDF and check it still goes to async-upload.php.

AI Use

Code and description written with 🤖 Claude Code at my request. I will review and test.

🤖 Generated with Claude Code

https://claude.ai/code/session_018vwYjTNtbdhcmnECA2bZxP

The formats were listed twice, once to route files to the pipeline and once to type the media frame's placeholder tiles, so adding a format (eg. JPEG XL) meant finding both. Both now read one list in media-upload-pipeline.js, exposed to media-frame-upload.js as `wp.mediaUploadPipeline.getImageSubtype()`, with a pointer to the upload-media constants it mirrors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vwYjTNtbdhcmnECA2bZxP
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: afb7a780-4a9f-4984-a96b-632ece9b704e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props adamsilverstein.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@adamsilverstein
adamsilverstein merged commit 1654c43 into fix/csm-classic-non-image-uploads Nov 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant