Skip to content

Commit b05e34d

Browse files
committed
fix script tags in browser console logs
1 parent dff34ee commit b05e34d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

OpenContent/View.ascx.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
using Satrabel.OpenContent.Components.Datasource;
3939
using IDataSource = Satrabel.OpenContent.Components.Datasource.IDataSource;
4040
using SecurityAccessLevel = DotNetNuke.Security.SecurityAccessLevel;
41+
using Newtonsoft.Json.Serialization;
42+
using System.Reflection;
4143

4244
#endregion
4345

@@ -168,10 +170,13 @@ protected override void OnPreRender(EventArgs e)
168170
if (LogContext.IsLogActive && !Debugger.IsAttached)
169171
{
170172
ClientResourceManager.RegisterScript(Page, Page.ResolveUrl("~/DesktopModules/OpenContent/js/opencontent.js"), FileOrder.Js.DefaultPriority);
173+
var json = JsonConvert.SerializeObject(LogContext.Current.ModuleLogs(ModuleContext.ModuleId));
174+
json = json.Replace("<script>", "*script*");
175+
json = json.Replace("</script>", "*/script*");
171176
StringBuilder logScript = new StringBuilder();
172177
//logScript.AppendLine("<script type=\"text/javascript\"> ");
173178
logScript.AppendLine("$(document).ready(function () { ");
174-
logScript.AppendLine("var logs = " + System.Web.HttpUtility.HtmlEncode(JsonConvert.SerializeObject(LogContext.Current.ModuleLogs(ModuleContext.ModuleId))) + "; " );
179+
logScript.AppendLine("var logs = " + json + "; " );
175180
logScript.AppendLine("$.fn.openContent.printLogs(\"Module " + ModuleContext.ModuleId + " - " + ModuleContext.Configuration.ModuleTitle + "\", logs);");
176181
logScript.AppendLine("});");
177182
//logScript.AppendLine("</script>");
@@ -472,4 +477,6 @@ private void RenderHttpException(NotAuthorizedException ex)
472477
#endregion
473478
}
474479

480+
481+
475482
}

0 commit comments

Comments
 (0)