mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19052: Fixing encoding issues with shape tracing
Work Item: 19052 --HG-- branch : 1.x
This commit is contained in:
@@ -12,6 +12,7 @@ using Orchard.Security;
|
||||
using Orchard.Themes;
|
||||
using Orchard.UI;
|
||||
using Orchard.UI.Admin;
|
||||
using System.Web;
|
||||
|
||||
namespace Orchard.DesignerTools.Services {
|
||||
[OrchardFeature("Orchard.DesignerTools")]
|
||||
@@ -203,8 +204,12 @@ namespace Orchard.DesignerTools.Services {
|
||||
}
|
||||
|
||||
public static string FormatJsonValue(string value) {
|
||||
if(String.IsNullOrEmpty(value)) {
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
// replace " by \" in json strings
|
||||
return value.Replace(@"\", @"\\").Replace("\"", @"\""").Replace("\r\n", @"\n").Replace("\r", @"\n").Replace("\n", @"\n");
|
||||
return HttpUtility.HtmlEncode(value).Replace(@"\", @"\\").Replace("\"", @"\""").Replace("\r\n", @"\n").Replace("\r", @"\n").Replace("\n", @"\n");
|
||||
}
|
||||
|
||||
private static string FormatShapeFilename(string shape, string shapeType, string displayType, string themePrefix, string extension) {
|
||||
|
@@ -60,8 +60,8 @@ shapeTracingMetadataHost[@Model.ShapeId].shape = {
|
||||
</text>
|
||||
}
|
||||
],
|
||||
html: '@ShapeTracingFactory.FormatJsonValue(RemoveEmptyLines(RemoveBeacons(Display(Model.ChildContent).ToString())))',
|
||||
templateContent: '@(ShapeTracingFactory.FormatJsonValue(String.IsNullOrWhiteSpace((string)Model.TemplateContent) ? @T("Content not available as coming from source code.").ToString() : (string)Model.TemplateContent))',
|
||||
html: '@Html.Raw(ShapeTracingFactory.FormatJsonValue(RemoveEmptyLines(RemoveBeacons(Display(Model.ChildContent).ToString()))))',
|
||||
templateContent: '@Html.Raw(ShapeTracingFactory.FormatJsonValue(String.IsNullOrWhiteSpace((string)Model.TemplateContent) ? @T("Content not available as coming from source code.").ToString() : (string)Model.TemplateContent))',
|
||||
model: { @(new MvcHtmlString((string)@Model.Dump)) }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user