Commit 265fb7e 1 parent 1422076 commit 265fb7e Copy full SHA for 265fb7e
File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -881,7 +881,9 @@ fn parse_escape<'de, R: Read<'de>>(
881
881
// utf-8 string the surrogates are required to be paired,
882
882
// whereas deserializing a byte string accepts lone surrogates.
883
883
n1 @ 0xD800 ..=0xDBFF => {
884
- if tri ! ( peek_or_eof( read) ) != b'\\' {
884
+ if tri ! ( peek_or_eof( read) ) == b'\\' {
885
+ read. discard ( ) ;
886
+ } else {
885
887
return if validate {
886
888
read. discard ( ) ;
887
889
error ( read, ErrorCode :: UnexpectedEndOfHexEscape )
@@ -890,9 +892,10 @@ fn parse_escape<'de, R: Read<'de>>(
890
892
Ok ( ( ) )
891
893
} ;
892
894
}
893
- read. discard ( ) ;
894
895
895
- if tri ! ( peek_or_eof( read) ) != b'u' {
896
+ if tri ! ( peek_or_eof( read) ) == b'u' {
897
+ read. discard ( ) ;
898
+ } else {
896
899
return if validate {
897
900
read. discard ( ) ;
898
901
error ( read, ErrorCode :: UnexpectedEndOfHexEscape )
@@ -906,7 +909,6 @@ fn parse_escape<'de, R: Read<'de>>(
906
909
parse_escape ( read, validate, scratch)
907
910
} ;
908
911
}
909
- read. discard ( ) ;
910
912
911
913
let n2 = tri ! ( read. decode_hex_escape( ) ) ;
912
914
You can’t perform that action at this time.
0 commit comments