Closed rymsha closed 3 years ago
@sigdestad any comment on this?
May or may not be the same issue:
When trying to set up a catch-all-existing-content mapping like for example…
<mapping controller="/lib/external-frontend/previewProxy.js" order="98">
<match>type:'.+:.+'</match>
</mapping>
…it also makes that controller handle paths to non-existing content - effectively overriding 404 behavior for that site.
When calling portalLib.getContent
in that controller, for a path to non-existing content, it returns / falls back to the root site item.
That is defineltly a bug
It looks like the same issue Introduced by this commit https://github.com/enonic/xp/commit/968e47c626e0d654 as desired functionality: for missing content MappingHandler resolves first available parent content and memoizes for rendering (if controller or filter allows it)
We'll fix it by rolling back this "feature" - so controllers/filters will still "see" first available content, but rendering won't happen (same as it would be without mapping controller/filter)
After a second thought with @sigdestad we decided to remove recursive resolution of content to "first available".
URL pattern that matches unresolvable content will still work (filter/controller with pattern /a/.*
will still BE CALLED for /a/b/missing
) but content won't be resolved anymore (Will be null).
This will make content resolution with and without mapping filters work equally.
Applications that relied on old (now considered invalid) behavior should either use getSite
or implement own logic to get some "fallback" content.
https://github.com/enonic/xp/issues/8417#issuecomment-706027199
https://github.com/enonic/xp/issues/8417#issuecomment-726733265