From 2736fa451cfd2c2984546fa08b400e75fbbff2b7 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Thu, 19 Feb 2026 13:42:32 -0500 Subject: [PATCH] support html encoded content --- Oqtane.Server/Infrastructure/SiteTasks/GlobalReplaceTask.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Oqtane.Server/Infrastructure/SiteTasks/GlobalReplaceTask.cs b/Oqtane.Server/Infrastructure/SiteTasks/GlobalReplaceTask.cs index 14b11ae4..364032a9 100644 --- a/Oqtane.Server/Infrastructure/SiteTasks/GlobalReplaceTask.cs +++ b/Oqtane.Server/Infrastructure/SiteTasks/GlobalReplaceTask.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Net; using System.Text.Json; using Microsoft.Extensions.DependencyInjection; using Oqtane.Models; @@ -123,9 +124,9 @@ namespace Oqtane.Infrastructure { var moduleObject = ActivatorUtilities.CreateInstance(provider, moduleType); var moduleContent = ((IPortable)moduleObject).ExportModule(pageModule.Module); - if (!string.IsNullOrEmpty(moduleContent) && moduleContent.Contains(find, comparisonType) && globalReplace.Content) + if (!string.IsNullOrEmpty(moduleContent) && moduleContent.Contains(WebUtility.HtmlEncode(find), comparisonType) && globalReplace.Content) { - moduleContent = moduleContent.Replace(find, replace, comparisonType); + moduleContent = moduleContent.Replace(WebUtility.HtmlEncode(find), WebUtility.HtmlEncode(replace), comparisonType); ((IPortable)moduleObject).ImportModule(pageModule.Module, moduleContent, pageModule.Module.ModuleDefinition.Version); log += $"Module Content Updated: {pageModule.Title} Page: /{page.Path}
"; }