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:
@@ -172,7 +172,7 @@ function vercelBlobStorageInternal(
|
||||
options: { baseUrl: string } & VercelBlobStorageOptions,
|
||||
): Adapter {
|
||||
return ({ collection, prefix }): GeneratedAdapter => {
|
||||
const { access, addRandomSuffix, baseUrl, cacheControlMaxAge, token } = options
|
||||
const { access, addRandomSuffix, baseUrl, cacheControlMaxAge, clientUploads, token } = options
|
||||
|
||||
if (!token) {
|
||||
throw new Error('Vercel Blob storage token is required')
|
||||
@@ -180,6 +180,7 @@ function vercelBlobStorageInternal(
|
||||
|
||||
return {
|
||||
name: 'vercel-blob',
|
||||
clientUploads,
|
||||
generateURL: getGenerateUrl({ baseUrl, prefix }),
|
||||
handleDelete: getHandleDelete({ baseUrl, prefix, token }),
|
||||
handleUpload: getHandleUpload({
|
||||
|
||||
Reference in New Issue
Block a user