fix(storage-*): client uploads with disablePayloadAccessControl: true (#11530)

Fixes https://github.com/payloadcms/payload/issues/11473

Previously, when `disablePayloadAccessControl: true` was defined, client
uploads were working improperly. The reason is that
`addDataAndFileToRequest` expects `staticHandler` to be defined and we
don't add in case if `disablePayloadAccessControl: true`.

This PR makes it so otherwise and if we have `clientUploads`, it pushes
the "proxied" handler that responses only when the file was requested in
the context of client upload (from `addDataAndFileToRequest`)
This commit is contained in:
Sasha
2025-03-05 20:59:49 +02:00
committed by GitHub
parent 6939a835ca
commit 5cc0e74471
7 changed files with 28 additions and 4 deletions

View File

@@ -141,6 +141,7 @@ function uploadthingInternal(options: UploadthingStorageOptions): Adapter {
return (): GeneratedAdapter => {
const {
clientUploads,
options: { acl = 'public-read', ...utOptions },
} = options
@@ -148,6 +149,7 @@ function uploadthingInternal(options: UploadthingStorageOptions): Adapter {
return {
name: 'uploadthing',
clientUploads,
fields,
generateURL,
handleDelete: getHandleDelete({ utApi }),