You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6fc83d7
Browse filesBrowse the repository at this point in the historyBrowse files
fix(plugin-cloud-storage): store processed bytes for cropped and mislabeled 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]>
0 commit comments