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

Manage aliases (redirects) within five.localsitemanager folders #3947

Open
petschki opened this issue May 3, 2024 · 1 comment
Open

Manage aliases (redirects) within five.localsitemanager folders #3947

petschki opened this issue May 3, 2024 · 1 comment

Comments

@petschki
Copy link
Member

petschki commented May 3, 2024

I've came across this when using collective.lineage but I think this should be fixed here. Lineage basically only marks a folder as IObjectManagerSite and takes care of the persistent components registered to the base site.

Testsetup

  1. Create /Plone site
  2. Create a Folder Subsite and mark it as IChildSite
  3. Inside the subsite create a page Testpage, go to @@manage-aliases and add an alias /supertestpage
  4. In the existing aliases there's the new entry /subsite/supertestpage

What I expect

Redirect the path /subsite/supertestpage to /subsite/testpage

What really happens

The logic of the aliases browser view (https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/controlpanel/browser/redirects.py#L132) is:

  1. check if the provided alias is within a "navigationrooted" folder and add its path (if not already provided by the user) -> that's correct because plone_portal_state.portal_url() correctly traverses to ISiteRoot which is /Plone and plone_portal_state.navigation_root_url() is /Plone/subsite so the result is /subsite/supertestpage
  2. try to "absolutize" the path with the Plone portal path -> since this checks with zope.component.hooks.getSite it gets our IObjectSiteManager and you end up with the absolutized path /Plone/subsite/subsite/supertestpage

Solution

Use plone_portal_state.portal() to determine the absolute ISiteRoot path here https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/controlpanel/browser/redirects.py#L51

Workaround

Add the redirects in @@redirection-controlpanel with the paths /subsite/supertestpage -> /subsite/testpage

@mauritsvanrees
Copy link
Sponsor Member

That sounds like it should work, without breaking the default case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants