Fix local detection of Dexterity @@images resources in Impress url_fetcher - #169
Open
Lunga001 wants to merge 1 commit into
Open
Fix local detection of Dexterity @@images resources in Impress url_fetcher#169Lunga001 wants to merge 1 commit into
Lunga001 wants to merge 1 commit into
Conversation
Treat @@images URLs as local resources by traversing to their owning content object. The @@images browser view handles image field paths dynamically, so traversing the complete URL can return None and cause the publisher to incorrectly fetch the image externally. Continue using the complete image path for the authenticated subrequest and use the response Content-Type when available.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue/feature this PR addresses
Linked issue: #168
Fixes the detection of local Dexterity image resources when rendering PDFs.
Browser views such as
@@imagesresolve the image field segment dynamically,therefore traversing the complete image URL may return
Noneeven though theresource belongs to the current Plone site.
This causes the publisher to incorrectly delegate image loading to
default_url_fetcher(), resulting in external HTTP requests and connectiontimeouts.
Current behavior before PR
The image is classified as an external resource and fetched with
default_url_fetcher().
Typical log output:
context=None
External URL, delegate to default URL fetcher...
The PDF generation waits for the external connection timeout before continuing.
Desired behavior after PR is merged
Dexterity @@images resources should be treated as local resources and fetched
through an authenticated subrequest, just like other Plone resources.
--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.