packages/@uppy/companion/src/server/controllers/s3.js
function completeMultipartUpload (req, res, next) {
    // @ts-ignore The `uppy` property is added by middleware before reaching here.
    const client = req.uppy.s3Client
    const { uploadId } = req.params
    const { key } = req.query
    const { parts } = req.body

    if (typeof key !== 'string') {
      return res.status(400).json({ error: 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' })
    }
    if (!Array.isArray(parts) || !parts.every(isValidPart)) {
      return res.status(400).json({ error: 's3: `parts` must be an array of {ETag, PartNumber} objects.' })
    }

    client.completeMultipartUpload({
      Bucket: config.bucket,
      Key: key,
      UploadId: uploadId,
      MultipartUpload: {
        Parts: parts
      }
    }, (err, data) => {
      if (err) {
        next(err)
        return
      }
      res.json({
        location: data.Location
      })
    })
  }
function completeMultipartUpload (req, res, next) {
    // @ts-ignore The `uppy` property is added by middleware before reaching here.
    const client = req.uppy.s3Client
    const { uploadId } = req.params
    const { key } = req.query
    const { parts } = req.body

    if (typeof key !== 'string') {
      return res.status(400).json({ error: 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' })
    }
    if (!Array.isArray(parts) || !parts.every(isValidPart)) {
      return res.status(400).json({ error: 's3: `parts` must be an array of {ETag, PartNumber} objects.' })
    }

    client.completeMultipartUpload({
      Bucket: config.bucket,
      Key: key,
      UploadId: uploadId,
      MultipartUpload: {
        Parts: parts
      }
    }, (err, data) => {
      if (err) {
        next(err)
        return
      }
      res.json({
        location: data.Location
      })
    })
  }
function completeMultipartUpload ( req , res , next ) { // @ts-ignore The `uppy` property is added by middleware before reaching here. const client = req . uppy . s3Client const { uploadId } = req . params const { key } = req . query const { parts } = req . body if ( typeof key !== 'string' ) { return res . status ( 400 ) . json ( { error : 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' } ) } if ( ! Array . isArray ( parts ) || ! parts . every ( isValidPart ) ) { return res . status ( 400 ) . json ( { error : 's3: `parts` must be an array of {ETag, PartNumber} objects.' } ) } client . completeMultipartUpload ( { Bucket : config . bucket , Key : key , UploadId : uploadId , MultipartUpload : { Parts : parts } } , ( err , data ) => { if ( err ) { next ( err ) return } res . json ( { location : data . Location } ) } ) }
Complete a multipart upload, combining all the parts into a single object in the S3 bucket.

Expected URL parameters:
- uploadId - The uploadId returned from `createMultipartUpload`.
Expected query parameters:
- key - The object key in the S3 bucket.
Expected JSON body:
- parts - An array of parts, see the `getUploadedParts` response JSON.
Response JSON:
- location - The full URL to the object in the S3 bucket.
Complete a multipart upload combining all the parts into a single object in the S3 bucket .