Skip to content

Commit

Permalink
add getBucket metadata argument (#4770)
Browse files Browse the repository at this point in the history
* add metadata to getBucket

* change getBucket call
  • Loading branch information
mifi authored Nov 2, 2023
1 parent 0854f12 commit 724bd7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/@uppy/companion/src/server/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ class Uploader {
const { client, options } = s3Options

const params = {
Bucket: getBucket(options.bucket),
Bucket: getBucket(options.bucket, null, this.options.metadata),
Key: options.getKey(null, filename, this.options.metadata),
ContentType: this.options.metadata.type,
Metadata: rfc2047EncodeMetadata(this.options.metadata),
Expand Down
4 changes: 2 additions & 2 deletions packages/@uppy/companion/src/server/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ module.exports.rfc2047EncodeMetadata = (metadata) => (
Object.fromEntries(Object.entries(metadata).map((entry) => entry.map(rfc2047Encode)))
)

module.exports.getBucket = (bucketOrFn, req) => {
const bucket = typeof bucketOrFn === 'function' ? bucketOrFn(req) : bucketOrFn
module.exports.getBucket = (bucketOrFn, req, metadata) => {
const bucket = typeof bucketOrFn === 'function' ? bucketOrFn(req, metadata) : bucketOrFn

if (typeof bucket !== 'string' || bucket === '') {
// This means a misconfiguration or bug
Expand Down

0 comments on commit 724bd7b

Please sign in to comment.