Skip to content

Commit

Permalink
fix script tags in browser console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sachatrauwaen committed May 29, 2019
1 parent dff34ee commit b05e34d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion OpenContent/View.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
using Satrabel.OpenContent.Components.Datasource;
using IDataSource = Satrabel.OpenContent.Components.Datasource.IDataSource;
using SecurityAccessLevel = DotNetNuke.Security.SecurityAccessLevel;
using Newtonsoft.Json.Serialization;
using System.Reflection;

#endregion

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



}

0 comments on commit b05e34d

Please sign in to comment.