JsonObjectParser escape sequence processing fix #23292
This commit is contained in:
parent
c3e9e2839a
commit
bf8bbd2807
2 changed files with 16 additions and 1 deletions
|
|
@ -297,6 +297,21 @@ class JsonFramingSpec extends AkkaSpec {
|
|||
| "key": "\""
|
||||
| }""".stripMargin
|
||||
}
|
||||
|
||||
"successfully parse a string that contains escape sequence" in {
|
||||
val buffer = new JsonObjectParser()
|
||||
buffer.offer(ByteString(
|
||||
"""
|
||||
|{
|
||||
| "key": "\\\""
|
||||
| }
|
||||
| """.stripMargin
|
||||
))
|
||||
|
||||
buffer.poll().get.utf8String shouldBe """{
|
||||
| "key": "\\\""
|
||||
| }""".stripMargin
|
||||
}
|
||||
}
|
||||
|
||||
"has nested array" should {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ import scala.annotation.switch
|
|||
pos += 1
|
||||
trimFront += 1
|
||||
} else if (input == Backslash) {
|
||||
if (lastInput == Backslash) isStartOfEscapeSequence = false
|
||||
if (lastInput == Backslash & isStartOfEscapeSequence) isStartOfEscapeSequence = false
|
||||
else isStartOfEscapeSequence = true
|
||||
pos += 1
|
||||
} else if (input == DoubleQuote) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue