From f76d744246addc05f42ddd247a435aa3ccd7fd79 Mon Sep 17 00:00:00 2001 From: Merlijn Vos Date: Thu, 1 Aug 2024 11:02:33 +0200 Subject: [PATCH 1/2] docs: fix getTemporarySecurityCredentials in aws-s3 (#5363) --- docs/uploader/aws-s3-multipart.mdx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/uploader/aws-s3-multipart.mdx b/docs/uploader/aws-s3-multipart.mdx index d2d629d471..6e7712b3ca 100644 --- a/docs/uploader/aws-s3-multipart.mdx +++ b/docs/uploader/aws-s3-multipart.mdx @@ -420,9 +420,6 @@ upload as query parameters. - Set it to `['name']` to only send the `name` field. - Set it to `true` (the default) to send _all_ metadata fields. -
-Deprecated options - #### `getTemporarySecurityCredentials(options)` :::note @@ -484,8 +481,6 @@ uppy.use(AwsS3, { }); ``` -
- [`gettemporarysecuritycredentials`]: #gettemporarysecuritycredentialsoptions [`shouldusemultipart`]: #shouldusemultipartfile [companion docs]: /docs/companion From b9582e1e67eded2404aa09b2d31cd9f956dfa295 Mon Sep 17 00:00:00 2001 From: Evgenia Karunus Date: Thu, 1 Aug 2024 15:18:55 +0500 Subject: [PATCH 2/2] Transform the `accept` prop into a string everywhere (#5380) * `/dev/Dashboard.js` - add all restrictions for the development environment * `AddFiles.tsx` - turn `accept` into a string * everywhere - make `accept` a string across uppy --- packages/@uppy/dashboard/src/components/AddFiles.tsx | 2 +- packages/@uppy/drag-drop/src/DragDrop.tsx | 3 +-- packages/@uppy/file-input/src/FileInput.tsx | 6 +----- private/dev/Dashboard.js | 10 +++++++++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/@uppy/dashboard/src/components/AddFiles.tsx b/packages/@uppy/dashboard/src/components/AddFiles.tsx index da2d93d5e9..4a5243ef80 100644 --- a/packages/@uppy/dashboard/src/components/AddFiles.tsx +++ b/packages/@uppy/dashboard/src/components/AddFiles.tsx @@ -55,7 +55,7 @@ class AddFiles extends Component { name="files[]" multiple={this.props.maxNumberOfFiles !== 1} onChange={this.onFileInputChange} - accept={this.props.allowedFileTypes} + accept={this.props.allowedFileTypes?.join(', ')} ref={refCallback} /> ) diff --git a/packages/@uppy/drag-drop/src/DragDrop.tsx b/packages/@uppy/drag-drop/src/DragDrop.tsx index b22e3f5b5f..1bc94200cc 100644 --- a/packages/@uppy/drag-drop/src/DragDrop.tsx +++ b/packages/@uppy/drag-drop/src/DragDrop.tsx @@ -165,8 +165,7 @@ export default class DragDrop extends UIPlugin< }} name={this.opts.inputName} multiple={restrictions.maxNumberOfFiles !== 1} - // @ts-expect-error We actually want to coerce the array to a string (or keep it as null/undefined) - accept={restrictions.allowedFileTypes} + accept={restrictions.allowedFileTypes?.join(', ')} onChange={this.onInputChange} /> ) diff --git a/packages/@uppy/file-input/src/FileInput.tsx b/packages/@uppy/file-input/src/FileInput.tsx index f3c260d6d7..09cc9fbc0e 100644 --- a/packages/@uppy/file-input/src/FileInput.tsx +++ b/packages/@uppy/file-input/src/FileInput.tsx @@ -96,10 +96,6 @@ export default class FileInput extends UIPlugin< } satisfies h.JSX.IntrinsicElements['input']['style'] const { restrictions } = this.uppy.opts - const accept = - restrictions.allowedFileTypes ? - restrictions.allowedFileTypes.join(',') - : undefined return (
@@ -110,7 +106,7 @@ export default class FileInput extends UIPlugin< name={this.opts.inputName} onChange={this.handleInputChange} multiple={restrictions.maxNumberOfFiles !== 1} - accept={accept} + accept={restrictions.allowedFileTypes?.join(', ')} ref={(input) => { this.input = input as HTMLFileInputElement }} diff --git a/private/dev/Dashboard.js b/private/dev/Dashboard.js index d750b783af..8e9f98f70d 100644 --- a/private/dev/Dashboard.js +++ b/private/dev/Dashboard.js @@ -79,7 +79,15 @@ function getCompanionKeysParams (name) { export default () => { const restrictions = undefined - // const restrictions = { requiredMetaFields: ['caption'], maxNumberOfFiles: 3 } + // const restrictions = { + // maxFileSize: 1 * 1000000, // 1mb + // minFileSize: 1 * 1000000, // 1mb + // maxTotalFileSize: 1 * 1000000, // 1mb + // maxNumberOfFiles: 3, + // minNumberOfFiles: 1, + // allowedFileTypes: ['image/*', '.jpg', '.jpeg', '.png', '.gif'], + // requiredMetaFields: ['caption'], + // } const uppyDashboard = new Uppy({ logger: debugLogger,