Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Transloadit-hosted Companion with other uploaders #5558

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set tus properties more explicitly
Murderlon committed Jan 23, 2025
commit 9fa3f7d54b11d9ae2d7ae0dad4a7080bdd3affbc
9 changes: 3 additions & 6 deletions packages/@uppy/aws-s3/src/index.ts
Original file line number Diff line number Diff line change
@@ -929,17 +929,14 @@ export default class AwsS3Multipart<
// Since the Transloadit plugin uses the tus plugin underneath, it's possible to have file.tus
// even though we are in this plugin.
// @ts-expect-error typed in @uppy/tus
if (file.tus) {
// @ts-expect-error typed in @uppy/tus
Object.assign(opts, file.tus)
}
const tusOpts = file.tus

return {
...file.remote?.body,
endpoint: opts.endpoint,
endpoint: tusOpts.endpoint ?? opts.endpoint,
protocol: this.uppy.getState().remoteUploader || 's3-multipart',
size: file.data.size,
headers: opts.headers,
headers: { ...opts.headers, ...tusOpts.headers },
metadata: file.meta,
}
}
11 changes: 4 additions & 7 deletions packages/@uppy/xhr-upload/src/index.ts
Original file line number Diff line number Diff line change
@@ -440,28 +440,25 @@ export default class XHRUpload<
opts.allowedMetaFields,
file.meta,
)
// When you .use(AwsS3) with .use(Transloadit, { companionOnly: true }),
// When you .use(XHR) with .use(Transloadit, { companionOnly: true }),
// local files are uploaded with this plugin and remote files with the Transloadit plugin.
// Since the Transloadit plugin uses the tus plugin underneath, it's possible to have file.tus
// even though we are in this plugin.
// @ts-expect-error typed in @uppy/tus
if (file.tus) {
// @ts-expect-error typed in @uppy/tus
Object.assign(opts, file.tus)
}
const tusOpts = file.tus

return {
...file.remote?.body,
protocol: this.uppy.getState().remoteUploader || 'multipart',
endpoint: opts.endpoint,
endpoint: tusOpts.endpoint ?? opts.endpoint,
headers: { ...opts.headers, ...tusOpts.headers },
size: file.data.size,
fieldname: opts.fieldName,
metadata: Object.fromEntries(
allowedMetaFields.map((name) => [name, file.meta[name]]),
),
httpMethod: opts.method,
useFormData: opts.formData,
headers: opts.headers,
}
}


Unchanged files with check annotations Beta

containerHeight,
containerWidth,
})}
<ErrorButton file={file} onClick={() => alert(file.error)} />

Check warning on line 153 in packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.tsx

GitHub Actions / Lint JavaScript/TypeScript

Unexpected alert
</div>
<div className="uppy-Dashboard-Item-status">
{renderAuthor({ file })}