|
@@ -68,14 +68,14 @@ module.exports = class AwsS3Multipart extends Plugin {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- assertHost () {
|
|
|
|
|
|
+ assertHost (method) {
|
|
if (!this.opts.companionUrl) {
|
|
if (!this.opts.companionUrl) {
|
|
- throw new Error('Expected a `companionUrl` option containing a Companion address.')
|
|
|
|
|
|
+ throw new Error(`Expected a \`companionUrl\` option containing a Companion address, or if you are not using Companion, a custom \`${method}\` implementation.`)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
createMultipartUpload (file) {
|
|
createMultipartUpload (file) {
|
|
- this.assertHost()
|
|
|
|
|
|
+ this.assertHost('createMultipartUpload')
|
|
|
|
|
|
const metadata = {}
|
|
const metadata = {}
|
|
|
|
|
|
@@ -93,7 +93,7 @@ module.exports = class AwsS3Multipart extends Plugin {
|
|
}
|
|
}
|
|
|
|
|
|
listParts (file, { key, uploadId }) {
|
|
listParts (file, { key, uploadId }) {
|
|
- this.assertHost()
|
|
|
|
|
|
+ this.assertHost('listParts')
|
|
|
|
|
|
const filename = encodeURIComponent(key)
|
|
const filename = encodeURIComponent(key)
|
|
return this.client.get(`s3/multipart/${uploadId}?key=${filename}`)
|
|
return this.client.get(`s3/multipart/${uploadId}?key=${filename}`)
|
|
@@ -101,7 +101,7 @@ module.exports = class AwsS3Multipart extends Plugin {
|
|
}
|
|
}
|
|
|
|
|
|
prepareUploadPart (file, { key, uploadId, number }) {
|
|
prepareUploadPart (file, { key, uploadId, number }) {
|
|
- this.assertHost()
|
|
|
|
|
|
+ this.assertHost('prepareUploadPart')
|
|
|
|
|
|
const filename = encodeURIComponent(key)
|
|
const filename = encodeURIComponent(key)
|
|
return this.client.get(`s3/multipart/${uploadId}/${number}?key=${filename}`)
|
|
return this.client.get(`s3/multipart/${uploadId}/${number}?key=${filename}`)
|
|
@@ -109,7 +109,7 @@ module.exports = class AwsS3Multipart extends Plugin {
|
|
}
|
|
}
|
|
|
|
|
|
completeMultipartUpload (file, { key, uploadId, parts }) {
|
|
completeMultipartUpload (file, { key, uploadId, parts }) {
|
|
- this.assertHost()
|
|
|
|
|
|
+ this.assertHost('completeMultipartUpload')
|
|
|
|
|
|
const filename = encodeURIComponent(key)
|
|
const filename = encodeURIComponent(key)
|
|
const uploadIdEnc = encodeURIComponent(uploadId)
|
|
const uploadIdEnc = encodeURIComponent(uploadId)
|
|
@@ -118,7 +118,7 @@ module.exports = class AwsS3Multipart extends Plugin {
|
|
}
|
|
}
|
|
|
|
|
|
abortMultipartUpload (file, { key, uploadId }) {
|
|
abortMultipartUpload (file, { key, uploadId }) {
|
|
- this.assertHost()
|
|
|
|
|
|
+ this.assertHost('abortMultipartUpload')
|
|
|
|
|
|
const filename = encodeURIComponent(key)
|
|
const filename = encodeURIComponent(key)
|
|
const uploadIdEnc = encodeURIComponent(uploadId)
|
|
const uploadIdEnc = encodeURIComponent(uploadId)
|