mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
apply review feedback : add uuid-file-name in presigned and sts mode of upload
This commit is contained in:
parent
842b19efb8
commit
8b6beccbe7
1 changed files with 9 additions and 1 deletions
|
|
@ -334,7 +334,15 @@ export default class AwsS3<M extends Meta, B extends Body> extends BasePlugin<
|
|||
}
|
||||
|
||||
#generateKey(file: UppyFile<M, B>): 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}`
|
||||
)
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue