mmmagic icon indicating copy to clipboard operation
mmmagic copied to clipboard

Can i be able to differentiate between .xlsm and .xlsx files using mmmagic ?

Open sunder-asuri opened this issue 1 year ago • 1 comments

i am trying to upload files and as the magic numbers of both .xlsm and .xlsx is same when i try to use this code

  let magic = new Magic(MAGIC_MIME_TYPE);
 magic.detectFile(fileLocation, (err, mimeType) => {
 if (err) throw err;
 console.log(mimeType);

 })
 

here if i upload a .xlsm file i get mime type as application/vnd.openxmlformats-officedocument.spreadsheetml.sheet which is same as for .xlsx file-type where as it should be application/vnd.ms-excel.sheet.macroEnabled.12. same is the case with .ppsm (getting mime type of .ppsx) and .docm (getting mime type of .docx)

is there a way to identify macro enabled files using this package in any way ?

sunder-asuri avatar Oct 22 '24 16:10 sunder-asuri

That's entirely dependent upon whatever magic database you're using.

mscdex avatar Oct 22 '24 16:10 mscdex