8000 isOleFile triggers an error when passing data of a small non-OLE file · Issue #142 · decalage2/olefile · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
isOleFile triggers an error when passing data of a small non-OLE file #142
Closed
@decalage2

Description

@decalage2

issue: the filename parameter of isOleFile can be either the path of the file to open on disk, or a bytes string containing the data of the file. If filename is less than 1536 bytes, isOleFile assumes that it's a filename and not data. This is fine for OLE files, because 1536 bytes is the minimal size of an OLE file.
But when we want to check a non-OLE file, this fails for files smaller than 1536 bytes, for applications passing data in the filename parameter instead of an actual filename.

Solution: add a second parameter data, set to None by default. If data contains a bytes string, then isOleFile should use it directly and ignore filename.
This should not break applications using only filename.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0