Fix #5767
This commit is contained in:
parent
fefafda9a0
commit
0ab618c2dc
@ -108,6 +108,9 @@ func (s escaped_string) MarshalJSON() ([]byte, error) {
|
||||
a('"')
|
||||
for _, r := range src {
|
||||
if ' ' <= r && r <= 126 {
|
||||
if r == '\\' || r == '"' {
|
||||
buf = append(buf, '\\')
|
||||
}
|
||||
buf = append(buf, byte(r))
|
||||
continue
|
||||
}
|
||||
@ -122,10 +125,6 @@ func (s escaped_string) MarshalJSON() ([]byte, error) {
|
||||
a('\\', 'f')
|
||||
case '\b':
|
||||
a('\\', 'b')
|
||||
case '\\':
|
||||
a('\\', '\\')
|
||||
case '"':
|
||||
a('\\', '"')
|
||||
default:
|
||||
a('\\', 'u')
|
||||
for s := 12; s >= 0; s -= 4 {
|
||||
|
||||
@ -14,6 +14,7 @@ func TestEncodeJSON(t *testing.T) {
|
||||
tests := map[string]string{
|
||||
"a b\nc\td\a": `a b\nc\td\u0007`,
|
||||
"•": `\u2022`,
|
||||
`a"b`: `a\"b`,
|
||||
"\U0001f123": `\ud83c\udd23`,
|
||||
}
|
||||
var s escaped_string
|
||||
|
||||
@ -302,6 +302,7 @@ func run_get_loop(opts *Options, args []string) (err error) {
|
||||
return fmt.Errorf("Could not detect the MIME type for: %s use --mime to specify it manually", arg)
|
||||
}
|
||||
}
|
||||
|
||||
defer func() {
|
||||
for _, o := range outputs {
|
||||
if o.dest != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user