Skip to content

Commit b5e2d92

Browse files
authored
Merge pull request #162 from babenek/doc
WPSOffice doc format detection
2 parents da74d48 + ba336f4 commit b5e2d92

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

filetype/types/document.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,12 @@ def match(self, buf):
116116
return True
117117
if (
118118
len(buf) > 2142
119-
and b"\x00\x0A\x00\x00\x00MSWordDoc\x00\x10\x00\x00\x00Word.Document.8\x00\xF49\xB2q"
120-
in buf[2075:2142]
119+
and (
120+
b"\x00\x0A\x00\x00\x00MSWordDoc\x00\x10\x00\x00\x00Word.Document.8\x00\xF49\xB2q"
121+
in buf[2075:2142]
122+
or b"W\0o\0r\0d\0D\0o\0c\0u\0m\0e\0n\0t\0"
123+
in buf[0x580:0x598]
124+
)
121125
):
122126
return True
123127

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ commands = pytest \
2626
basepython = python3
2727
deps =
2828
flake8
29-
commands = flake8 {toxinidir} --extend-exclude tests,docs,build,dist,venv --extend-ignore=E501
29+
commands = flake8 {toxinidir} --extend-exclude tests,docs,build,dist,venv,.venv --extend-ignore=E501
3030

3131
[testenv:doc]
3232
basepython = python3

0 commit comments

Comments
 (0)