Skip to content

Commit e8ab61f

Browse files
committed
Catch IO advancement errors as well
1 parent c645ff4 commit e8ab61f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

v5/merge.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package jsonpatch
33
import (
44
"bytes"
55
"encoding/json"
6+
"errors"
67
"fmt"
8+
"io"
79
"reflect"
810
)
911

@@ -183,6 +185,12 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
183185
}
184186

185187
func isSyntaxError(err error) bool {
188+
if errors.Is(err, io.EOF) {
189+
return true
190+
}
191+
if errors.Is(err, io.ErrUnexpectedEOF) {
192+
return true
193+
}
186194
if _, ok := err.(*json.SyntaxError); ok {
187195
return true
188196
}

0 commit comments

Comments
 (0)