Use relaxed JSON escaping for command replies
Updated JSON serialization in CommandsService to use UnsafeRelaxedJsonEscaping for replies, ensuring special characters are not escaped unnecessarily when sending processed command results.
This commit is contained in:
parent
4216105037
commit
811baa74bc
1 changed files with 13 additions and 8 deletions
|
|
@ -1,15 +1,16 @@
|
||||||
using System.Text.Json;
|
using Newtonsoft.Json.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.ImportExport.Collada14;
|
||||||
using SecondBotEvents.Config;
|
using SecondBotEvents.Config;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Net.Http;
|
|
||||||
using OpenMetaverse.ImportExport.Collada14;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace SecondBotEvents.Services
|
namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
|
|
@ -325,7 +326,11 @@ namespace SecondBotEvents.Services
|
||||||
reply = "Error";
|
reply = "Error";
|
||||||
if (processed != null)
|
if (processed != null)
|
||||||
{
|
{
|
||||||
reply = JsonSerializer.Serialize(processed);
|
var options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
|
};
|
||||||
|
reply = JsonSerializer.Serialize(processed, options);
|
||||||
}
|
}
|
||||||
CommandNotice(C.command, source, String.Join("@@@", C.args), true, reply);
|
CommandNotice(C.command, source, String.Join("@@@", C.args), true, reply);
|
||||||
return new KeyValuePair<bool, string>(status, reply);
|
return new KeyValuePair<bool, string>(status, reply);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue