Skip to content

Traverse to theme resources from the portal #232

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

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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