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

Update valid reasons to not have a template on a content node to include having umbracoRedirect #15929

Open
wants to merge 1 commit into
base: contrib
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion src/Umbraco.Web.Website/Routing/UmbracoRouteValuesFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,12 @@
IPublishedRequest request = def.PublishedRequest;

// Here we need to check if there is no hijacked route and no template assigned but there is a content item.
// If this is the case we want to return a blank page.
// If this is the case we want to return a blank page, the only exception being if the content item has a redirect field present.
// We also check if templates have been disabled since if they are then we're allowed to render even though there's no template,
// for example for json rendering in headless.
if (request.HasPublishedContent()
&& !request.HasTemplate()
&& !request.IsRedirect()

Check warning on line 136 in src/Umbraco.Web.Website/Routing/UmbracoRouteValuesFactory.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (contrib)

❌ Getting worse: Complex Conditional

CheckNoTemplateAsync increases from 1 complex conditionals with 3 branches to 1 complex conditionals with 4 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
&& !_umbracoFeatures.Disabled.DisableTemplates
&& !hasHijackedRoute)
{
Expand Down
Loading