S3 Multipart getKey / Filename - Why not pass through req?

Re: providerOptions.s3.getKey(req, filename, metadata)

Regarding the availability of req here when using s3 multipart, the uppy docs state:

req , the HTTP request, for regular S3 uploads using the @uppy/aws-s3 plugin. This parameter is not available for multipart uploads using the @uppy/aws-s3-multipart plugin;

My question is … why? I’m building the return value of getKey based on information from req. I had a look at @uppy/companion/lib/server/Uploader.js and see no reason why to pass null instead of req. I made 2 lines of changes and now pass req through. Works fine. The thing is … I’m trying not to modify your core code unless absolutely necessary, so I’m wondering why it was decided that req shouldn’t be available for s3 multipart.

Thanks!

1 Like

Hello!

I don’t know exactly why it isn’t passed, I’d assume that the req for multipart isn’t stable, or that it causes errors in some occasions

I might be thinking of this the wrong way, but considering that S3 Multipart is well… multipart, it might be someone unstable to pass a request object

This is all just speculation however. I’ll update you when I get more information

- Andrew

I found an issue that discusses this directly after posting my response

Look through it here

tldr;

This is kind of an intentional behaviour, but not a good behaviour. It’s done this way because we don’t have the request object that caused a file to be downloaded from a remote provider like Dropbox, when we start uploading the file to the destination.

You can pass the info you’d need via metadata