mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Fixed the issue when reading or writing escaped JSON strings from and to LS.
This commit is contained in:
@@ -57,7 +57,7 @@ namespace RuriLib.LS
|
||||
input = input.Substring(token.Length).Trim();
|
||||
|
||||
if (type == TokenType.Literal)
|
||||
token = token.Substring(1, token.Length - 2).Replace("\\\"", "\"");
|
||||
token = token.Substring(1, token.Length - 2).Replace("\\\\", "\\").Replace("\\\"", "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,7 +219,8 @@ namespace RuriLib.LS
|
||||
return "^[^ ]*";
|
||||
|
||||
case TokenType.Literal:
|
||||
return "\\\"(\\\\.|[^\\\"])*\\\"";
|
||||
//return "\\\"(\\\\.|[^\\\"])*\\\"";
|
||||
return "\"(\\\\.|[^\\\"])*\"";
|
||||
|
||||
case TokenType.Arrow:
|
||||
return "^->";
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace RuriLib.LS
|
||||
public BlockWriter Literal(string literal, string property = "")
|
||||
{
|
||||
if (property != "" && CheckDefault(literal, property)) return this;
|
||||
Write($"\"{literal.Replace("\"", "\\\"")}\" ");
|
||||
Write($"\"{literal.Replace("\\", "\\\\").Replace("\"", "\\\"")}\" ");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user