libyal / libpff

Library and tools to access the Personal Folder File (PFF) and the Offline Folder File (OFF) format
GNU Lesser General Public License v3.0
289 stars 74 forks source link

pypff: Unexpected value `112` from file.content_type #131

Closed scanny closed 4 months ago

scanny commented 4 months ago

Summary In pypff, file.content_type produces unexpected integer value 112. Expected b'SM'.

To reproduce

>>> with open("Outlook.pst", rb) as f:
...     buf = read(10)
...
>>> buf[8:]
b'SM'

>>> f = pypff.open("Outlook.pst")
>>> f.content_type
112

I do note that asc(112) is 'p' and it occurred to me that might be short for PST or something, but based on the documentation of the file format I was expecting the bytes value b'SM'. https://github.com/libyal/libpff/blob/main/documentation/Personal%20Folder%20File%20(PFF)%20format.asciidoc#21-content-types

Can you advise whether this is a bug or whether I just missed the documentation for how file.content_type is encoded?

scanny commented 4 months ago

Ah, okay, writing this gave me an idea and I figured it out from the source:

LIBPFF_FILE_CONTENT_TYPE_PAB = (int) 'a', LIBPFF_FILE_CONTENT_TYPE_PST = (int) 'p', LIBPFF_FILE_CONTENT_TYPE_OST = (int) 'o'

Sorry to bother you and thanks for the library! :)