Skip to content

Commit

Permalink
Traverse to theme resources from the portal. Fix broken theme when re…
Browse files Browse the repository at this point in the history
…ndering accessible content contained in an inaccessible navigation-root. Fixes #142
  • Loading branch information
pbauer committed Dec 25, 2023
1 parent 7192565 commit 54e9141
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 2 additions & 0 deletions news/142.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Traverse to theme resources from the portal. Fix broken theme when rendering accessible content contained in an inaccessible navigation-root. Fixes #142
[pbauer]
9 changes: 3 additions & 6 deletions src/plone/app/theming/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,18 @@ def resolve(self, system_url, public_id, context):

context = findContext(request)
portalState = queryMultiAdapter((context, request), name="plone_portal_state")

if portalState is None:
root = None
else:
root = portalState.navigation_root()
portal = portalState.portal()

if not system_url.startswith("/"): # only for relative urls
root = portalState.navigation_root()
root_path = root.getPhysicalPath()
context_path = context.getPhysicalPath()[len(root_path) :]
if len(context_path) == 0:
system_url = "/" + system_url
else:
system_url = "/{:s}/{:s}".format("/".join(context_path), system_url)

response = subrequest(system_url, root=root)
response = subrequest(system_url, root=portal)
if response.status != 200:
LOGGER.error(f"Couldn't resolve {system_url:s}")
return None
Expand Down

0 comments on commit 54e9141

Please sign in to comment.