Skip to content

Commit

Permalink
Merge pull request #232 from plone/fix_theme_in_inaccessible_navroot
Browse files Browse the repository at this point in the history
Traverse to theme resources from the portal
  • Loading branch information
pbauer authored Jan 12, 2024
2 parents e46b6f4 + 54e9141 commit 4c87b37
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 4c87b37

Please sign in to comment.