-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
BUGFIX: Handle nodes with missing UriPathSegments in uriPathProjection #5412
Open
mficzel
wants to merge
3
commits into
neos:9.0
Choose a base branch
from
mficzel:bugfix/resilienceAgainstMissingUriPathSegments
base: 9.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
2445a69
TASK: Add testcase for documents that are projected without uriPathSe…
mficzel 828908e
BUGFIX: Use nodeAggregateId as fallback for uriPathSegment instead of ""
mficzel 64d52a7
TASK: Add site nodeName to testcases to avoid relying on invalid beha…
mficzel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
Neos.Neos/Tests/Behavior/Features/FrontendRouting/MissingPathSegments.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
@flowEntities @contentrepository | ||
Feature: Routing functionality if path segments are missing like during tethered node creation | ||
|
||
Background: | ||
Given using no content dimensions | ||
And using the following node types: | ||
"""yaml | ||
'Neos.Neos:Sites': | ||
superTypes: | ||
'Neos.ContentRepository:Root': true | ||
'Neos.Neos:Document': {} | ||
'Neos.Neos:Content': {} | ||
'Neos.Neos:Test.Routing.Page': | ||
superTypes: | ||
'Neos.Neos:Document': true | ||
properties: | ||
uriPathSegment: | ||
type: string | ||
'Neos.Neos:Test.Routing.Content': | ||
superTypes: | ||
'Neos.Neos:Content': true | ||
properties: | ||
uriPathSegment: | ||
type: string | ||
""" | ||
And using identifier "default", I define a content repository | ||
And I am in content repository "default" | ||
And I am user identified by "initiating-user-identifier" | ||
|
||
When the command CreateRootWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| newContentStreamId | "cs-identifier" | | ||
And I am in workspace "live" and dimension space point {} | ||
And the command CreateRootNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| nodeAggregateId | "lady-eleonode-rootford" | | ||
| nodeTypeName | "Neos.Neos:Sites" | | ||
|
||
# lady-eleonode-rootford | ||
# shernode-homes | ||
# sir-david-nodenborough | ||
# duke-of-contentshire (content node) | ||
# earl-o-documentbourgh | ||
# nody-mc-nodeface | ||
# | ||
And the following CreateNodeAggregateWithNode commands are executed: | ||
| nodeAggregateId | parentNodeAggregateId | nodeTypeName | initialPropertyValues | nodeName | | ||
| shernode-homes | lady-eleonode-rootford | Neos.Neos:Test.Routing.Page | {} | node1 | | ||
| sir-david-nodenborough | shernode-homes | Neos.Neos:Test.Routing.Page | {} | node2 | | ||
| duke-of-contentshire | sir-david-nodenborough | Neos.Neos:Test.Routing.Content | {} | node3 | | ||
| earl-o-documentbourgh | sir-david-nodenborough | Neos.Neos:Test.Routing.Page | {} | node4 | | ||
| nody-mc-nodeface | shernode-homes | Neos.Neos:Test.Routing.Page | {} | node5 | | ||
And A site exists for node name "node1" | ||
And the sites configuration is: | ||
"""yaml | ||
Neos: | ||
Neos: | ||
sites: | ||
'node1': | ||
preset: 'default' | ||
uriPathSuffix: '' | ||
contentDimensions: | ||
resolver: | ||
factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\NoopResolverFactory | ||
""" | ||
Scenario: Match homepage URL | ||
When I am on URL "/" | ||
Then the matched node should be "shernode-homes" in content stream "cs-identifier" and dimension "{}" | ||
|
||
Scenario: Resolve nodes correctly from homepage | ||
When I am on URL "/" | ||
Then the node "shernode-homes" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/" | ||
And the node "sir-david-nodenborough" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/sir-david-nodenborough" | ||
And the node "earl-o-documentbourgh" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/sir-david-nodenborough/earl-o-documentbourgh" | ||
|
||
Scenario: Match node lower in the tree | ||
When I am on URL "/sir-david-nodenborough/earl-o-documentbourgh" | ||
Then the matched node should be "earl-o-documentbourgh" in content stream "cs-identifier" and dimension "{}" | ||
|
||
Scenario: Resolve from node lower in the tree | ||
When I am on URL "/sir-david-nodenborough/earl-o-documentbourgh" | ||
Then the node "shernode-homes" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/" | ||
And the node "sir-david-nodenborough" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/sir-david-nodenborough" | ||
And the node "earl-o-documentbourgh" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/sir-david-nodenborough/earl-o-documentbourgh" | ||
|
||
Scenario: Add uri path segment on first level | ||
When the command SetNodeProperties is executed with payload: | ||
| Key | Value | | ||
| nodeAggregateId | "sir-david-nodenborough" | | ||
| originDimensionSpacePoint | {} | | ||
| propertyValues | {"uriPathSegment": "david-nodenborough-updated"} | | ||
And I am on URL "/" | ||
Then the node "sir-david-nodenborough" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/david-nodenborough-updated" | ||
And the node "earl-o-documentbourgh" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/david-nodenborough-updated/earl-o-documentbourgh" | ||
|
||
Scenario: Add uri path segment on second level | ||
When the command SetNodeProperties is executed with payload: | ||
| Key | Value | | ||
| nodeAggregateId | "earl-o-documentbourgh" | | ||
| originDimensionSpacePoint | {} | | ||
| propertyValues | {"uriPathSegment": "earl-documentbourgh-updated"} | | ||
And I am on URL "/" | ||
Then the node "earl-o-documentbourgh" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/sir-david-nodenborough/earl-documentbourgh-updated" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we discussed an alternative in line 273 but it doesnt really work :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still think resilience against missing uri path segments is better than adding an even tighter bond to the Neos NodeTypes. Even if this would work ;-)
The fallback way makes uriPathes more like a soft concern (which it is technically anyways) and allows routing of documents in cases where it is missing for any reason.
Only thing that would speak against that would be a case where the node-identifier based fallback does harm anything but i do not see a way for this to happen.