Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-singh-filestack committed Feb 2, 2024
1 parent 25691f0 commit 4e1c151
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom
try {
type = await fromBuffer(file);
} catch(e) {
// A temporary solution for some PNG files when resized
if (name == undefined){
// A temporary solution for some PNG files when resize
if (!name){
return 'image/png';
}
}

if (name && name.indexOf('.') > -1) {
const mime = extensionToMime(name);

Expand All @@ -123,12 +124,6 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom
if (type && excludedMimetypes.indexOf(type.mime) === -1) {
return type.mime;
}
// if we cant find types by extensions and we have magic bytes fallback to it
if (type) {
console.log('in the cond: ',type.mime)
return type.mime;
}
console.log('after the cond: ',type)

try {
if (isutf8(file)) {
Expand All @@ -141,7 +136,10 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom
// this is only fallback, omit it in coverage
/* istanbul ignore next */


// if we cant find types by extensions and we have magic bytes fallback to it
if (type) {
return type.mime;
}

};

Expand Down

0 comments on commit 4e1c151

Please sign in to comment.