Skip to content

Commit

Permalink
docs(changeset): Bump mime-standard to mime for more extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
apuntovanini committed May 16, 2024
1 parent b13151e commit 1edaea9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-bananas-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@uidu/media-core": major
---

Bump mime-standard to mime for more extensions
7 changes: 6 additions & 1 deletion packages/forms/field-file-uploader/examples/Basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ export default function Basic() {
allowMultipleUploadBatches: false,
restrictions: {
maxNumberOfFiles: 1,
allowedFileTypes: ['.csv', '.txt'],
allowedFileTypes: [
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'text/csv',
'text/plain',
],
},
}}
moduleOptions={{
Expand Down
2 changes: 1 addition & 1 deletion packages/media/media-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@uppy/core": "^3.10.1",
"@uppy/dashboard": "^3.8.1",
"@uppy/xhr-upload": "^3.6.4",
"mime-standard": "^1.0.2",
"mime": "^4.0.3",
"react-dropzone": "^14.2.3",
"tslib": "^2.6.2"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/media/media-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AwsS3, { AwsS3Options } from '@uppy/aws-s3';
import { Restrictions, UploadedUppyFile } from '@uppy/core';
import XHRUpload, { XHRUploadOptions } from '@uppy/xhr-upload';
import mime from 'mime-standard';
import mime from 'mime';
import { DropzoneProps } from 'react-dropzone';
import { FileIdentifier, FileType } from './types';

Expand Down Expand Up @@ -69,10 +69,10 @@ export function convertUppyAllowedFileTypesToMediaTypes(
) {
const result = {} as { [key: string]: string[] };
allowedFileTypes.forEach((allowedFileType) => {
if (mime[allowedFileType]) {
result[allowedFileType] = mime[allowedFileType].map(
(extension: string) => `.${extension}`,
);
if (mime.getAllExtensions(allowedFileType)) {
result[allowedFileType] = Array.from(
mime.getAllExtensions(allowedFileType),
).map((extension) => `.${extension}`);
}
});
return result;
Expand Down
18 changes: 10 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9637,7 +9637,7 @@ __metadata:
"@uppy/core": "npm:^3.10.1"
"@uppy/dashboard": "npm:^3.8.1"
"@uppy/xhr-upload": "npm:^3.6.4"
mime-standard: "npm:^1.0.2"
mime: "npm:^4.0.3"
react: "npm:^18.3.1"
react-dropzone: "npm:^14.2.3"
tslib: "npm:^2.6.2"
Expand Down Expand Up @@ -24155,13 +24155,6 @@ __metadata:
languageName: node
linkType: hard

"mime-standard@npm:^1.0.2":
version: 1.0.2
resolution: "mime-standard@npm:1.0.2"
checksum: 10/d158375113d3d2da0c4b6b133f428f793e602f0b1de19fa629a62f3e6efa710e85d9918319161eed2225ca674830b137020678b0b18f0e74cd159c72c3c1de4e
languageName: node
linkType: hard

"mime-types@npm:^2.1.12, mime-types@npm:^2.1.27, mime-types@npm:^2.1.31, mime-types@npm:~2.1.17, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34":
version: 2.1.35
resolution: "mime-types@npm:2.1.35"
Expand Down Expand Up @@ -24189,6 +24182,15 @@ __metadata:
languageName: node
linkType: hard

"mime@npm:^4.0.3":
version: 4.0.3
resolution: "mime@npm:4.0.3"
bin:
mime: bin/cli.js
checksum: 10/fdabb0f0aecd34c11be108e7a73d74a9f672bee8586d3353834ebebedfb8420bdf932efad11a343de994978504024dab5b7846fc4cae4b1855b571a01d27ee6e
languageName: node
linkType: hard

"mimic-fn@npm:^1.0.0":
version: 1.2.0
resolution: "mimic-fn@npm:1.2.0"
Expand Down

0 comments on commit 1edaea9

Please sign in to comment.