1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

fix parser for escape

This commit is contained in:
Darien Raymond 2016-12-15 15:53:23 +01:00
parent 1ab02e0a6b
commit 4e3ed19308
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"io"
)
// State is the internal state of parser.
type State byte
const (
@ -50,7 +51,7 @@ func (v *Reader) Read(b []byte) (int, error) {
p = append(p, x)
}
case StateEscape:
p = append(p, x)
p = append(p, '\\', x)
v.state = StateContent
case StateDoubleQuote:
switch x {

View File

@ -4,6 +4,7 @@ import (
"testing"
"bytes"
"v2ray.com/core/testing/assert"
. "v2ray.com/core/tools/conf/json"
)
@ -33,6 +34,7 @@ text text 2*`},
{`"//"content`, `"//"content`},
{`abcd'//'abcd`, `abcd'//'abcd`},
{`"\""`, `"\""`},
{`\"/*abcd*/\"`, `\"\"`},
}
for _, testCase := range data {