Skip to content

fix: S3 upload silent skip when select projects out mimeType/filename#17010

Open
deepshekhardas wants to merge 1 commit into
payloadcms:mainfrom
deepshekhardas:fix/s3-upload-select-projection
Open

fix: S3 upload silent skip when select projects out mimeType/filename#17010
deepshekhardas wants to merge 1 commit into
payloadcms:mainfrom
deepshekhardas:fix/s3-upload-select-projection

Conversation

@deepshekhardas

Copy link
Copy Markdown
Contributor

When a POST request uses ?select[...]\ to project mimeType/filename out of the response doc, the cloud-storage plugin silently skips uploading to S3.

Fix by falling back to req.file properties when data.filename/data.mimeType are undefined due to select projection. Also handle sizes fallback using payloadUploadSizes when data.sizes is missing.

Closes #16670

When a POST request uses ?select[…] to project mimeType/filename out of the
response doc, the cloud-storage plugin silently skips uploading to S3.

Fix by falling back to req.file properties when data.filename/data.mimeType
are undefined due to select projection. Also handle sizes fallback using
payloadUploadSizes when data.sizes is missing.

Closes payloadcms#16670
@deepshekhardas deepshekhardas requested a review from denolfe as a code owner June 16, 2026 06:45
@github-actions

Copy link
Copy Markdown
Contributor

Pull Request titles must follow the Conventional Commits specification and have valid scopes.

The subject "S3 upload silent skip when select projects out mimeType/filename" found in the pull request title "fix: S3 upload silent skip when select projects out mimeType/filename"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.

feat(ui): add Button component
^    ^    ^
|    |    |__ Subject
|    |_______ Scope
|____________ Type

if (data?.sizes) {
Object.entries(data.sizes).forEach(([key, resizedFileData]) => {
if (payloadUploadSizes?.[key] && resizedFileData.mimeType) {
const sizes = data?.sizes ?? payloadUploadSizes

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice fix for the main file case. I think there may still be a gap for resized images when sizes is also projected out because req.payloadUploadSizes only has the resized buffers, while the resized file metadata still comes from data.sizes. So with this fallback, resizedFileData can be a Buffer, which means resizedFileData?.mimeType is undefined and the resized variants still won’t be uploaded.

Could you, please, add a regression test for an image upload with configured sizes where the selected doc omits sizes along with filename / mimeType?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: storage-s3 silently skips S3 upload when create request uses ?select[…] to project out mimeType

2 participants