Skip to content

fix(media): give each image size a unique filename - #123

Merged
lightningxcookie merged 1 commit into
devfrom
fix/media-size-filenames
Nov 28, 2026
Merged

lightningxcookie merged 1 commit into
devfrom
fix/media-size-filenames

Conversation

@lightningxcookie

Copy link
Copy Markdown
Collaborator

Issues

Closes

Description

Follow-up to #120. Uploading an image smaller than 640px currently fails with a 500.

With withoutEnlargement: true, an image smaller than both size boxes comes out at its original dimensions for both thumbnail and large. Payload's default size filename is name-WxH.webp, so both sizes get the same filename. Vercel Blob refuses to overwrite an existing pathname, so the second write throws and the whole upload fails.

This adds generateImageName so size files include the size name: name-thumbnail-WxH.webp, name-large-WxH.webp.

Checklist

  • Make sure you are requesting to pull a feature/fix branch (right side). Don't request the main branch!
  • Make sure you are making a pull request against the dev branch (left side). Also you should start your branch off dev branch.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation (if appropriate).

How To Review

One file: packages/cms/src/collections/Media.ts.

Notes

  • Found while regenerating sizes for existing media: 8 small images (logos, small headshots, one gallery photo) failed this way. They'll be retried once this is deployed.
  • Existing size files keep their current names; only new uploads use the new naming.
  • Tested: CMS typecheck and Biome. Not yet tested against the deployed CMS.

@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
medrevue Ready Ready Preview Nov 28, 2026 1:53am UTC

@lightningxcookie
lightningxcookie merged commit 718eef8 into dev Nov 28, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 70798d4c Deployed Nov 28, 2026 by vercel[bot]
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