From 3174eabcd54573e23af053ca64351520935e2080 Mon Sep 17 00:00:00 2001 From: Ludovic Thauvin Date: Wed, 6 Sep 2023 14:52:20 +0200 Subject: [PATCH 1/3] Fixes invalid cookie name --- .../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..d9ffcb9f9f7 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(selectedItem.Menu.MenuName + '_' + HttpUtility.UrlEncode(ShellScope.Context.Settings.Name), selectedItem.Hash); while (selectedItem.Parent != null) { From 3f7aa68014aaa0f0412ca52b2e18353679745cc6 Mon Sep 17 00:00:00 2001 From: Ludovic Thauvin Date: Wed, 6 Sep 2023 17:59:39 +0200 Subject: [PATCH 2/3] include menu name --- src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs index d9ffcb9f9f7..e1ca41db475 100644 --- a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs +++ b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs @@ -130,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 + '_' + HttpUtility.UrlEncode(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) { From 994949b56222bd5371577f1918b406af0887ad1d Mon Sep 17 00:00:00 2001 From: Ludovic Thauvin Date: Wed, 6 Sep 2023 18:02:12 +0200 Subject: [PATCH 3/3] string interpolation --- src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs index e1ca41db475..d50f047c59f 100644 --- a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs +++ b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs @@ -130,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(HttpUtility.UrlEncode(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) {