Repository navigation
fix(storage-vercel-blob): keep the receipt key for processed client uploads with addRandomSuffix - #18921
Merged
nathanlentz merged 1 commit intoOct 23, 2026
Conversation
This was referenced Oct 21, 2026
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
nathanlentz
force-pushed
the
fix/client-upload-random-suffix-3x
branch
from
October 21, 2026 15:37
38eeda5 to
423c5fc
Compare
nathanlentz
force-pushed
the
fix/client-upload-random-suffix-3x
branch
from
October 22, 2026 01:22
423c5fc to
dc5c962
Compare
nathanlentz
changed the base branch from
fix/client-upload-edits-3x
to
fix/vercel-blob-random-suffix-sizes-3x
October 22, 2026 01:25
nathanlentz
force-pushed
the
fix/client-upload-random-suffix-3x
branch
from
October 22, 2026 13:00
dc5c962 to
a758968
Compare
JarrodMFlesch
force-pushed
the
fix/client-upload-random-suffix-3x
branch
2 times, most recently
from
October 22, 2026 16:04
53f6d28 to
a8dfac3
Compare
nathanlentz
force-pushed
the
fix/client-upload-random-suffix-3x
branch
from
October 22, 2026 18:45
a8dfac3 to
0f4e46c
Compare
JarrodMFlesch
force-pushed
the
fix/client-upload-random-suffix-3x
branch
2 times, most recently
from
October 22, 2026 19:56
187883d to
e6c67af
Compare
JarrodMFlesch
approved these changes
Oct 22, 2026
This was referenced Oct 22, 2026
…ploads with addRandomSuffix
nathanlentz
force-pushed
the
fix/client-upload-random-suffix-3x
branch
from
October 23, 2026 13:40
e6c67af to
613c2dd
Compare
nathanlentz
added a commit
that referenced
this pull request
Oct 23, 2026
…abeled client uploads (#18913) Stacked on #18388. Review and merge #18388 first. ## Summary Direct client uploads with a crop or a wrong MIME type do not store the processed file. A crop returns a 500 error. A file with a wrong MIME type keeps the original bytes in storage, but the document describes the processed file. ## How - The storage plugin runs a second update to save adapter metadata. That update now runs without `uploadEdits`. Before, it applied the crop again and tried to download the file, which failed. `main` already does this. - When Payload corrects the MIME type, `req.file` now points to the corrected copy of the file. Before, only the copy was marked as processed, so the storage plugin skipped the upload. - When a crop and `resizeOptions` are both set, the temp file now gets the cropped and resized bytes. Before, it got only the cropped bytes. ## Tests The resized client-upload test now also covers a cropped upload and an upload with a wrong MIME type. The test collection has an image size, so each case also covers crops together with `imageSizes`. Each case checks that the stored sizes of the main file and the image size are equal to their `filesize` values on the document. Both new cases failed before this change. ## Related work - Stack: #18388 → this PR → #18920 → #18921 - Issue: #18333 --------- Co-authored-by: Jarrod Flesch <[email protected]>
nathanlentz
added a commit
that referenced
this pull request
Oct 23, 2026
…RandomSuffix (#18920) Stacked on #18913. Review and merge #18388 and #18913 first. This PR does not depend on their changes. It is in the stack because #18921 changes the same adapter code. Fixes #9589. ## Summary With `addRandomSuffix: true`, Vercel Blob uploads the main file and each image size in parallel. Every upload wrote its suffixed name to the same `data.filename`. As a result, the document filename could point to an image size, and no image size got its suffixed name. Every image-size URL returned 404. Now each upload writes its suffixed name only to its own entry: an image size updates `sizes.<name>.filename`, and the main file updates `filename`. ## How - After each upload finishes, the adapter finds the image size whose filename matches the uploaded file. If no size matches, the file is the main file. - Two image sizes with the same dimensions get the same filename. The adapter finds the entry after the upload, so a size that an earlier upload renamed does not match again. Each size gets its own entry. - `storage-uploadthing` already uses this pattern for its per-file keys. - `plugin-cloud-storage` does not change. ## Tests - A unit test checks that the main file and an image size each update only their own filename. - A unit test uploads two image sizes with the same filename in parallel. It checks that each size gets its own suffixed filename. This test failed before this change. - An integration test uploads an image with one image size and `addRandomSuffix: true`. It checks that every filename on the document has an object in storage, and that the main object size is equal to the document `filesize`. This test failed on every run before this change. ## Related work - Stack: #18388 → #18913 → this PR → #18921 - The bug started in #5928, the first version of the storage packages. - Not in scope: #18384 (the create response has a `url` without the suffix) and #18804 (focal point with a new filename). --------- Co-authored-by: Jarrod Flesch <[email protected]>
Contributor
|
🚀 This is included in version v3.92.1 |
nathanlentz
added a commit
that referenced
this pull request
Oct 27, 2026
…s it for upload-thing storage (#19012) Stacked on #19010. Review and merge #19010 first. When Payload processed a direct-client upload, UploadThing stored the processed file under a new key. The original file from the browser stayed in storage, and nothing used it. Now the adapter deletes the original file when the processed file replaces it. ## Related work - Stack: #19010 → this PR - Issue: #18333 - #18921 fixed the same kind of extra file for Vercel Blob with `addRandomSuffix`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #18913. Review and merge #18388 and #18913 first.
Summary
With
addRandomSuffix: true, a processed client upload was saved again under a new name with a suffix. The original file from the browser stayed in storage, and nothing used it. Now the processed file replaces the original file, and the document keeps the original filename.How
req.contextfor cleanup. The adapter turns offaddRandomSuffixwhen the file'stempFilePathis the same as that saved path._objectKey, so legacy overwrite receipts without_objectKeyare covered too.payloadnow exportsCLIENT_UPLOAD_TEMP_FILE_PATH_CONTEXT_KEY, so the adapter does not copy the key string.Related work
addRandomSuffixbug with image sizes. Both PRs addpackages/storage-vercel-blob/src/adapter.spec.ts, so the second one to merge needs a rebase.