payloadcms / payloadcms/payload

storage-vercel-blob: clientUploads makes the item unique after PUT so the new media link gets 404s and the existing file for non postfixed version is overwritten

Open
#17,823 0 comments 0 reactions 1 assignee View on GitHub

@r1tsuu is already working on this.

Since Aug 17, 2026.

plugin: other v3
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

If you upload the same filename twice, Payload creates a new media item (photo-1.jpg), but that original file uploaded never gets stored. The admin thumbnail looks fine. The main URL 404s. And the first photo.jpg in Blob gets overwritten, even though this is meant to be a new file.

What’s happening: with clientUploads: true, the browser PUTs photo.jpg first (allowOverwrite: true). Payload then uniquifies the new row to photo-1.jpg and only writes the sizes under that name. So photo-1-300x….jpg exists, photo-1.jpg does not, and the old photo.jpg blob is replaced.

It shouldn’t overwrite the old blob, and the new -1 row should have a file behind it. Local disk / server-side uploads already do this.

addRandomSuffix is not a workaround — it breaks image sizes (#9589).

Image Image

Happy to open a 3.x PR that uniquifies the blob key before the client PUT

Link to the code that reproduces this issue

https://github.com/zakriabilal/payload-vercel-blob-filename-collision

Reproduction Steps
  1. You need your own Vercel Blob store and a BLOB_READ_WRITE_TOKEN. This does not reproduce on local disk.
  2. Clone https://github.com/zakriabilal/payload-vercel-blob-filename-collision
  3. Copy .env.example to .env. Set DATABASE_URL (local Mongo), PAYLOAD_SECRET, and BLOB_READ_WRITE_TOKEN.
  4. pnpm install && pnpm dev
  5. Create the first user at /admin
  6. Media → upload photo.jpg from the repo root
  7. Upload photo.jpg again as a new item (same filename)
  8. Library shows photo.jpg and photo-1.jpg. Both thumbnails look fine
  9. Open the original URL for photo-1.jpg — 404
  10. In the Vercel Blob store: photo-1-300x….jpg exists, photo-1.jpg does not, and the first photo.jpg was overwritten
Which area(s) are affected?

plugin: other

Environment Info
Binaries:
  Node: 24.14.0
  npm: 11.11.1
  Yarn: 1.22.22
  pnpm: 11.21.0
Relevant Packages:
  payload: 3.88.0
  next: 16.3.0
  @payloadcms/db-mongodb: 3.88.0
  @payloadcms/graphql: 3.88.0
  @payloadcms/next/utilities: 3.88.0
  @payloadcms/plugin-cloud-storage: 3.88.0
  @payloadcms/richtext-lexical: 3.88.0
  @payloadcms/storage-vercel-blob: 3.88.0
  @payloadcms/translations: 3.88.0
  @payloadcms/ui/shared: 3.88.0
  react: 19.2.6
  react-dom: 19.2.6
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.5.0: Tue Jun  9 22:28:29 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.