|
@@ -23,8 +23,8 @@ module.exports = function s3 (config) {
|
|
|
* - fields - Form fields to send along.
|
|
|
*/
|
|
|
function getUploadParameters (req, res, next) {
|
|
|
- // @ts-ignore The `uppy` property is added by middleware before reaching here.
|
|
|
- const client = req.uppy.s3Client
|
|
|
+ // @ts-ignore The `companion` property is added by middleware before reaching here.
|
|
|
+ const client = req.companion.s3Client
|
|
|
const key = config.getKey(req, req.query.filename)
|
|
|
if (typeof key !== 'string') {
|
|
|
return res.status(500).json({ error: 's3: filename returned from `getKey` must be a string' })
|
|
@@ -68,8 +68,8 @@ module.exports = function s3 (config) {
|
|
|
* - uploadId - The ID of this multipart upload, to be used in later requests.
|
|
|
*/
|
|
|
function createMultipartUpload (req, res, next) {
|
|
|
- // @ts-ignore The `uppy` property is added by middleware before reaching here.
|
|
|
- const client = req.uppy.s3Client
|
|
|
+ // @ts-ignore The `companion` property is added by middleware before reaching here.
|
|
|
+ const client = req.companion.s3Client
|
|
|
const key = config.getKey(req, req.body.filename)
|
|
|
const { type, metadata } = req.body
|
|
|
if (typeof key !== 'string') {
|
|
@@ -112,8 +112,8 @@ module.exports = function s3 (config) {
|
|
|
* - Size - size of this part.
|
|
|
*/
|
|
|
function getUploadedParts (req, res, next) {
|
|
|
- // @ts-ignore The `uppy` property is added by middleware before reaching here.
|
|
|
- const client = req.uppy.s3Client
|
|
|
+ // @ts-ignore The `companion` property is added by middleware before reaching here.
|
|
|
+ const client = req.companion.s3Client
|
|
|
const { uploadId } = req.params
|
|
|
const { key } = req.query
|
|
|
|
|
@@ -164,8 +164,8 @@ module.exports = function s3 (config) {
|
|
|
* - url - The URL to upload to, including signed query parameters.
|
|
|
*/
|
|
|
function signPartUpload (req, res, next) {
|
|
|
- // @ts-ignore The `uppy` property is added by middleware before reaching here.
|
|
|
- const client = req.uppy.s3Client
|
|
|
+ // @ts-ignore The `companion` property is added by middleware before reaching here.
|
|
|
+ const client = req.companion.s3Client
|
|
|
const { uploadId, partNumber } = req.params
|
|
|
const { key } = req.query
|
|
|
|
|
@@ -203,8 +203,8 @@ module.exports = function s3 (config) {
|
|
|
* Empty.
|
|
|
*/
|
|
|
function abortMultipartUpload (req, res, next) {
|
|
|
- // @ts-ignore The `uppy` property is added by middleware before reaching here.
|
|
|
- const client = req.uppy.s3Client
|
|
|
+ // @ts-ignore The `companion` property is added by middleware before reaching here.
|
|
|
+ const client = req.companion.s3Client
|
|
|
const { uploadId } = req.params
|
|
|
const { key } = req.query
|
|
|
|
|
@@ -238,8 +238,8 @@ module.exports = function s3 (config) {
|
|
|
* - location - The full URL to the object in the S3 bucket.
|
|
|
*/
|
|
|
function completeMultipartUpload (req, res, next) {
|
|
|
- // @ts-ignore The `uppy` property is added by middleware before reaching here.
|
|
|
- const client = req.uppy.s3Client
|
|
|
+ // @ts-ignore The `companion` property is added by middleware before reaching here.
|
|
|
+ const client = req.companion.s3Client
|
|
|
const { uploadId } = req.params
|
|
|
const { key } = req.query
|
|
|
const { parts } = req.body
|