diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs index 59fe11dd09e..f713809c120 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; @@ -43,6 +44,14 @@ public ValueTask EvaluateAsync(Condition condition) private ValueTask EvaluateAsync(ContentTypeCondition condition) { var operatorComparer = _operatorResolver.GetOperatorComparer(condition.Operation); + + // If no content types are considered, use the empty string as the value to compare against, + // since we still want comparisons such as "Does Not Equal", "Does Not Start With", etc. to evaluate to true in this case. + if (!_contentTypes.Any()) + { + return ValueTask.FromResult(operatorComparer.Compare(condition.Operation, string.Empty, condition.Value)); + } + foreach (var contentType in _contentTypes) { if (operatorComparer.Compare(condition.Operation, contentType, condition.Value))