Skip to content

Commit

Permalink
Merge branch 'develop' into sc-add-alt-text
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth-3 committed Apr 19, 2024
2 parents 5319d0c + f5d5cdb commit ceb65db
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [3.30.2](https://github.com/filestack/filestack-js/compare/v3.30.1...v3.30.2) (2024-03-04)

### Updgrade
* **picker:** Upgraded picker to v1.26.2.

## [3.30.1](https://github.com/filestack/filestack-js/compare/v3.30.0...v3.30.1) (2024-02-07)

### Updgrade
* **picker:** Upgraded picker to v1.26.1.

## [3.30.0](https://github.com/filestack/filestack-js/compare/v3.29.0...v3.30.0) (2024-01-18)

### Updgrade
* **picker:** Upgraded picker to v1.26.0.

## [3.29.0](https://github.com/filestack/filestack-js/compare/v3.28.0...v3.29.0) (2024-01-05)

### Updgrade
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filestack-js",
"version": "3.29.0",
"version": "3.30.2",
"description": "Official JavaScript library for Filestack",
"main": "build/main/index.js",
"module": "build/module/index.js",
Expand Down
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* @private
*/
const PICKER_VERSION = 'beta';

/**
* @private
*/
Expand Down
6 changes: 6 additions & 0 deletions src/lib/utils/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ export const ExtensionsMap = {
'iso',
'msp',
'buffer',
'psdata',
'indt',
'hpd',
'mxd',
'indd',
'vsm',
],
'application/oda': ['oda'],
'application/oebps-package+xml': ['opf'],
Expand Down
13 changes: 8 additions & 5 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,12 @@ export const uniqueId = (len: number = 10): string => {
*/
export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Promise<string> => {
let type;

try {
type = await fromBuffer(file);
} catch(e) {
console.warn("An exception occurred while processing the buffer:", e.message);
}
const excludedMimetypes = ['text/plain', 'application/octet-stream', 'application/x-ms', 'application/x-msi', 'application/zip'];

if (type && excludedMimetypes.indexOf(type.mime) === -1) {
return type.mime;
}

if (name && name.indexOf('.') > -1) {
const mime = extensionToMime(name);
Expand All @@ -122,6 +118,12 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom
}
}

const excludedMimetypes = ['text/plain', 'application/octet-stream', 'application/x-ms', 'application/x-msi', 'application/zip'];

if (type && excludedMimetypes.indexOf(type.mime) === -1) {
return type.mime;
}

try {
if (isutf8(file)) {
return 'text/plain';
Expand All @@ -138,6 +140,7 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom
return type.mime;
}

return 'application/octet-stream';
};

/**
Expand Down

0 comments on commit ceb65db

Please sign in to comment.