diff --git a/packages/@uppy/transloadit/src/AssemblyOptions.js b/packages/@uppy/transloadit/src/AssemblyOptions.js index b557717b59..1fc621166b 100644 --- a/packages/@uppy/transloadit/src/AssemblyOptions.js +++ b/packages/@uppy/transloadit/src/AssemblyOptions.js @@ -48,7 +48,7 @@ function dedupe (list) { })) } -async function getAssemblyOptions (file, options) { +export async function getAssemblyOptions (file, options) { const assemblyOptions = typeof options.assemblyOptions === 'function' ? await options.assemblyOptions(file, options) : options.assemblyOptions diff --git a/packages/@uppy/transloadit/src/index.js b/packages/@uppy/transloadit/src/index.js index 8710a18725..cf366058a5 100644 --- a/packages/@uppy/transloadit/src/index.js +++ b/packages/@uppy/transloadit/src/index.js @@ -5,7 +5,7 @@ import BasePlugin from '@uppy/core/lib/BasePlugin.js' import Tus from '@uppy/tus' import Assembly from './Assembly.js' import Client from './Client.js' -import AssemblyOptions, { validateParams } from './AssemblyOptions.js' +import AssemblyOptions, { validateParams, getAssemblyOptions } from './AssemblyOptions.js' import AssemblyWatcher from './AssemblyWatcher.js' import locale from './locale.js' @@ -191,12 +191,8 @@ export default class Transloadit extends BasePlugin { #createAssembly (fileIDs, uploadID, options) { this.uppy.log('[Transloadit] Create Assembly') - return this.client.createAssembly({ - params: options.params, - fields: options.fields, - expectedFiles: fileIDs.length, - signature: options.signature, - }).then(async (newAssembly) => { + const createAssembly = assemblyOptions => this.client.createAssembly(assemblyOptions) + return getAssemblyOptions(fileIDs, options).then(createAssembly).then(async (newAssembly) => { const files = this.uppy.getFiles().filter(({ id }) => fileIDs.includes(id)) if (files.length !== fileIDs.length) { if (files.length === 0) {