Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content of dict returned by doc.embfile_info() does not fit to documentation #4050

Open
dasmy opened this issue Nov 14, 2024 · 2 comments
Open
Labels
fix developed release schedule to be determined Fixed in next release

Comments

@dasmy
Copy link

dasmy commented Nov 14, 2024

Description of the bug

Using doc.embfile_add(), I added an attachment to a pdf file. Then, I retrieved its metadata using doc.embfile_info().

In contrast to the documentation at https://pymupdf.readthedocs.io/en/latest/document.html#Document.embfile_info, the resulting dict does not contain a desc field for the description. Instead, the description is found under the key descender:

print(doc.embfile_info(name))
{'name': 'pdf_scraper_markdown_content', 'collection': 0, 'filename': 'fulltext.md', 'ufilename': 'fulltext.md', 'descender': 'Markdown representation of the PDF file content.', 'size': 67, 'length': 67, 'creationDate': "D:20241114103806+02'00'", 'modDate': "D:20241114103806+02'00'"}

How to reproduce the bug

With docbeing a pymupdf.Document, just call

doc.embfile_add('test', b'foobar', desc='some text')
print(doc.embfile_info('test'))

Result:

{'name': 'test', 'collection': 0, 'filename': 'test', 'ufilename': 'test', '**descender**': 'some text', 'size': 6, 'length': 6, 'creationDate': "D:20241114105413+02'00'", 'modDate': "D:20241114105413+02'00'"}

PyMuPDF version

1.24.13

Operating system

MacOS

Python version

3.12

@JorjMcKie JorjMcKie added the fix developed release schedule to be determined label Nov 14, 2024
@JorjMcKie
Copy link
Collaborator

The problem was overwriting a dictionary key value. Easy fix.
Of course, "description" is correct, which will be reflected in the returned dictionary and the documentation likewise.

@dasmy
Copy link
Author

dasmy commented Nov 14, 2024

Nice. That was quick 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix developed release schedule to be determined Fixed in next release
Projects
None yet
Development

No branches or pull requests

3 participants