From f4a09f92fc34f04554d4217f28adab592adb969c Mon Sep 17 00:00:00 2001 From: James Pretorius <50090107+jbytes1027@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:12:23 -0500 Subject: [PATCH] Trim Liquid content urls (#17322) Fixes #9299 --- .../OrchardCore.Liquid/Filters/ContentUrlFilter.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Liquid/Filters/ContentUrlFilter.cs b/src/OrchardCore.Modules/OrchardCore.Liquid/Filters/ContentUrlFilter.cs index 05e20d91002..84af20d6189 100644 --- a/src/OrchardCore.Modules/OrchardCore.Liquid/Filters/ContentUrlFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Liquid/Filters/ContentUrlFilter.cs @@ -17,6 +17,9 @@ public ValueTask ProcessAsync(FluidValue input, FilterArguments argu { var urlHelper = _urlHelperFactory.GetUrlHelper(context.ViewContext); - return ValueTask.FromResult(new StringValue((urlHelper).Content(input.ToStringValue()))); + var trimmedInputString = input.ToStringValue().Trim(); + var absoluteUrl = urlHelper.Content(trimmedInputString); + + return ValueTask.FromResult(new StringValue(absoluteUrl)); } }