-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
The generateUploadUrl on the R2 class takes in a customKey param
Lines 159 to 174 in 594a9b4
| /** | |
| * Generate a signed URL for uploading an object to R2. | |
| * | |
| * @param customKey (optional) - A custom R2 object key to use. Must be unique. | |
| * @returns A promise that resolves to an object with the following fields: | |
| * - `key` - The R2 object key. | |
| * - `url` - A signed URL for uploading the object. | |
| */ | |
| async generateUploadUrl(customKey?: string) { | |
| const key = customKey || crypto.randomUUID(); | |
| const url = await getSignedUrl( | |
| this.r2, | |
| new PutObjectCommand({ Bucket: this.config.bucket, Key: key }) | |
| ); | |
| return { key, url }; | |
| } |
but the generateUploadUrl mutation returned from the client doesn't take in a customKey
Lines 349 to 361 in 594a9b4
| generateUploadUrl: mutationGeneric({ | |
| args: {}, | |
| returns: v.object({ | |
| key: v.string(), | |
| url: v.string(), | |
| }), | |
| handler: async (ctx) => { | |
| if (opts?.checkUpload) { | |
| await opts.checkUpload(ctx, this.config.bucket); | |
| } | |
| return this.generateUploadUrl(); | |
| }, | |
| }), |
would be really nice to be able to pass in a customKey as an optional arg to the mutation.
Currently we'd have to create a mutation which could take in a key if we want to use a custom key
Metadata
Metadata
Assignees
Labels
No labels