Skip to content

Commit

Permalink
Merge pull request #179 from ferstar/master
Browse files Browse the repository at this point in the history
Add a new CDFV2 Microsoft Word filetype and fix tox deps
  • Loading branch information
h2non committed Aug 28, 2024
2 parents b846e7e + b6d23a3 commit 7eb61a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions filetype/types/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def match(self, buf):
)
):
return True
if (
len(buf) > 663 and buf[512:531] == b"R\x00o\x00o\x00t\x00 \x00E\x00n\x00t\x00r\x00y"
and buf[640:663] == b"W\x00o\x00r\x00d\x00D\x00o\x00c\x00u\x00m\x00e\x00n\x00t"
):
return True

return False

Expand Down
Binary file added tests/fixtures/sample_2.doc
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_guess_zstd(self):
self.assertEqual(kind.extension, 'zst')

def test_guess_doc(self):
for name in 'sample.doc', 'sample_1.doc':
for name in 'sample.doc', 'sample_1.doc', 'sample_2.doc':
kind = filetype.guess(os.path.join(FIXTURES, name))
self.assertIsNotNone(kind)
self.assertEqual(kind.mime, 'application/msword')
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ commands = flake8 {toxinidir} --extend-exclude tests,docs,build,dist,venv,.venv
basepython = python3
deps =
pdoc3
setuptools
commands = pdoc --html --force --output-dir docs filetype

[testenv:clean]
Expand Down

0 comments on commit 7eb61a8

Please sign in to comment.