Skip to content

Commit e7b4e27

Browse files
authored
Merge pull request #10 from voult/patch-1
Detection of .xls files
2 parents b44cd13 + 5066801 commit e7b4e27

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/SoftCreatR/MimeDetector/MimeDetector.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,21 @@ public function getFileType(): array
832832
];
833833
}
834834

835+
/**
836+
* Microsoft Office Excel, according to this document
837+
*
838+
* @link https://www.garykessler.net/library/file_sigs.html
839+
*/
840+
if (
841+
$this->checkForBytes([0x09, 0x08, 0x10, 0x00, 0x00, 0x06, 0x05, 0x00], 2048)
842+
|| $this->checkForBytes([0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff], 512)
843+
) {
844+
return [
845+
'ext' => 'xls',
846+
'mime' => 'application/vnd.ms-excel'
847+
];
848+
}
849+
835850
return [
836851
'ext' => 'msi',
837852
'mime' => 'application/x-msi'

0 commit comments

Comments
 (0)