From 9cd2398e9cba2c37930b79f88940e480c53d9dfc Mon Sep 17 00:00:00 2001 From: ludovic-th <65158865+ludovic-th@users.noreply.github.com> Date: Fri, 8 Sep 2023 09:29:29 +0200 Subject: [PATCH] Fixes invalid cookie name (#14280) --- .../OrchardCore.Navigation.Core/NavigationHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs index c6dd46a22b5..d50f047c59f 100644 --- a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs +++ b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using System.Web; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.WebUtilities; using OrchardCore.Environment.Shell.Scope; @@ -129,7 +130,7 @@ private static void ApplySelection(dynamic parentShape, ViewContext viewContext) // Apply the selection to the hierarchy if (selectedItem != null) { - viewContext.HttpContext.Response.Cookies.Append(selectedItem.Menu.MenuName + '_' + ShellScope.Context.Settings.Name, selectedItem.Hash); + viewContext.HttpContext.Response.Cookies.Append(HttpUtility.UrlEncode($"{selectedItem.Menu.MenuName}_{ShellScope.Context.Settings.Name}"), selectedItem.Hash); while (selectedItem.Parent != null) {