Skip to content

Commit

Permalink
log when getting mime
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-singh-filestack committed Jan 4, 2024
1 parent 5f7d57d commit 4d3bd68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/api/upload/file_tools.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const getFile = (input: InputFile, sanitizeOptions?: SanitizeOptions): Pr
async res => {
let mime = file.type;
let minimumBytes = 4100;
console.log(!file.type)
if (!file.type || file.type.length === 0 || file.type === 'text/plain') {
console.log("just for fun");
mime = await getMimetype(await res.slice(0, minimumBytes), filename);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const uniqueId = (len: number = 10): string => {
*/
export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Promise<string> => {
let type = await fromBuffer(file);

console.log("reaches here")
const excludedMimetypes = ['text/plain', 'application/octet-stream', 'application/x-ms', 'application/x-msi', 'application/zip'];

if (type && excludedMimetypes.indexOf(type.mime) === -1) {
Expand Down

0 comments on commit 4d3bd68

Please sign in to comment.