Skip to content

Commit 7eb61a8

Browse files
authored
Merge pull request #179 from ferstar/master
Add a new CDFV2 Microsoft Word filetype and fix tox deps
2 parents b846e7e + b6d23a3 commit 7eb61a8

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

filetype/types/document.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ def match(self, buf):
124124
)
125125
):
126126
return True
127+
if (
128+
len(buf) > 663 and buf[512:531] == b"R\x00o\x00o\x00t\x00 \x00E\x00n\x00t\x00r\x00y"
129+
and buf[640:663] == b"W\x00o\x00r\x00d\x00D\x00o\x00c\x00u\x00m\x00e\x00n\x00t"
130+
):
131+
return True
127132

128133
return False
129134

tests/fixtures/sample_2.doc

1.64 KB
Binary file not shown.

tests/test_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_guess_zstd(self):
9494
self.assertEqual(kind.extension, 'zst')
9595

9696
def test_guess_doc(self):
97-
for name in 'sample.doc', 'sample_1.doc':
97+
for name in 'sample.doc', 'sample_1.doc', 'sample_2.doc':
9898
kind = filetype.guess(os.path.join(FIXTURES, name))
9999
self.assertIsNotNone(kind)
100100
self.assertEqual(kind.mime, 'application/msword')

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ commands = flake8 {toxinidir} --extend-exclude tests,docs,build,dist,venv,.venv
3232
basepython = python3
3333
deps =
3434
pdoc3
35+
setuptools
3536
commands = pdoc --html --force --output-dir docs filetype
3637

3738
[testenv:clean]

0 commit comments

Comments
 (0)