Fix bad URL when pattern refers to empty singular relationship#433
Fix bad URL when pattern refers to empty singular relationship#433jorrit wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: abd1535 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
2dd2800 to
254cc2c
Compare
254cc2c to
abd1535
Compare
|
I have rewritten the error message to make it more specific for the single instance in which it applies: a reference to a manytomany relationship without an index. I would suggest that in that case the index 0 is used. In that case, there will never be a situation that is unhandled. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #433 +/- ##
==========================================
- Coverage 34.73% 34.60% -0.14%
==========================================
Files 2 2
Lines 763 763
Branches 192 189 -3
==========================================
- Hits 265 264 -1
- Misses 397 400 +3
+ Partials 101 99 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does it do?
Since 661a844 I experience bad friendly urls when the pattern contains a reference to an optional manyToOne field and the field is empty.
Why is it needed?
My pattern is
/over/[parent_page.slug]/[slug].When my page contains no
parent_page, the resulting friendly URL becomes/over/[parent_page.slug]/cookiesinstead of/over/cookies.In addition, the following is logged to the server log:
Something went wrong whilst resolving the pattern.How to test it?
Create a content type with a manyToOne or One to One relationship.
Refer to this relationship in the URL pattern.
Generate the URL for an entity where this relationship is empty.