From 8b6beccbe706f7a1cfd626700c83ddbc7fb8f8a9 Mon Sep 17 00:00:00 2001 From: prakash Date: Thu, 2 Jul 2026 16:10:50 +0530 Subject: [PATCH] apply review feedback : add uuid-file-name in presigned and sts mode of upload --- packages/@uppy/aws-s3/src/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/@uppy/aws-s3/src/index.ts b/packages/@uppy/aws-s3/src/index.ts index 7f0dbd511..205decbd7 100644 --- a/packages/@uppy/aws-s3/src/index.ts +++ b/packages/@uppy/aws-s3/src/index.ts @@ -334,7 +334,15 @@ export default class AwsS3 extends BasePlugin< } #generateKey(file: UppyFile): string { - return this.opts.generateObjectKey?.(file) ?? file.name + // in companion mode, no need to run the generateObjectKey function even if it's passed by the user, + // because the key is generated on the server side and we need to remove the option to pass generateObjectKey in companion mode. + if ('companionEndpoint' in this.opts) { + return file.name + } + return ( + this.opts.generateObjectKey?.(file) ?? + `${crypto.randomUUID()}-${file.name}` + ) } // --------------------------------------------------------------------------