All work

 
50 of 60

FileGetMimeType doesn't detect cffile uploaded xlsx files with the wrong file extension

Description

take a xlsx file, rename it to xlsxxx

FileGetMimeType(path) returns "application/octet-stream"

strict is default, so it should be checking the file's header? https://docs.lucee.org/reference/functions/filegetmimetype.html

Environment

None

Attachments

1
  • 25 Jul 2019, 11:54 am

Details

Assignee

Reporter

Priority

Labels

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 17 July 2019 at 17:01
Updated 14 May 2025 at 11:54

Activity

Gavin Baumanis 
24 November 2024 at 12:17

I found this ticket as a result of getting the wrong mime time for docx file.

I get application/x-tika-ooxml when passing a xlsx AND docx, too - when using strict='true'

var mimeType = fileGetMimeType(file="#prc.Document.getFileNameOnDisk()#", strict="true"); writeLog(file="mimeType",text="mimeType : #mimeType#");

gives the following log entry

"INFO","XNIO-1 task-1","11/24/2024","23:09:40","MyApp","mimeType : application/x-tika-ooxml"

 

Using “properties” on Explorer on Windows (11) - gives the following mime-type

officedocument.wordprocessingml.document

Zac Spitzer 
25 July 2019 at 11:54

i just tried creating another simple test case and it worked as you described, tho that tika mime type is also wrong

however, if i upload the same sample file using <cffile action="upload" and then use FileGetMimeType I get “application/octet-stream”

Julian Halliwell 
24 July 2019 at 13:46

I'm not seeing that result with 5.3.4.4 or any other version I've tried.

FileGetMimeType( ExpandPath( "test.xlsxxx" ) );

is returning "application/x-tika-ooxml" for me. Are you sure your file is definitely an OOXML spreadsheet? You can check it using https://github.com/cfsimplicity/lucee-spreadsheet:

spreadsheet = New Spreadsheet(); workbook = spreadsheet.read( ExpandPath( "test.xlsxxx" ) ); dump( spreadsheet.isXmlFormat( workbook ) );