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

Address 4043 #4044

Merged
merged 1 commit into from
Nov 12, 2024
Merged

Address 4043 #4044

merged 1 commit into from
Nov 12, 2024

Conversation

JorjMcKie
Copy link
Collaborator

When duplicating a page without /Contents objects, make sure to detect this situation.
Addresses issue 4043.

When duplicating a page without /Contents objects, make sure to detect this situation.
Copy link
Collaborator

@julian-smith-artifex-com julian-smith-artifex-com left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JM_read_contents() seems to return either a mupdf buffer if contents is array, or a bytes/str (from pdf_load_stream()) or empty bytes. So isn't it possible for if res and res.m_internal: to still fail if res is non-empty str or bytes?

@JorjMcKie
Copy link
Collaborator Author

Yes, I am aware of that problem. The return is always one of 2 alternatives:

  • an mupdf.FzBuffer in all cases where the page has /Contents at all,
  • otherwise an empty bytes object.
    So a really clean solution should be one of the following:
  • A FzBuffer of either length 0 - or length 1 containing b" ".
  • None - which I would prefer as it reflects the facts in the best way.

@JorjMcKie
Copy link
Collaborator Author

Your opinion?

@julian-smith-artifex-com
Copy link
Collaborator

Ah yes, i misread pdf_load_stream() as returning a char*. Agree that returning None would be better than b"" but that can be fixed in future.

@JorjMcKie JorjMcKie merged commit be1fa5f into main Nov 12, 2024
2 checks passed
@JorjMcKie JorjMcKie deleted the address-4043 branch November 12, 2024 15:34
@github-actions github-actions bot locked and limited conversation to collaborators Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants