diff options
| author | Stefan Kögl <stefan@skoegl.net> | 2017-09-10 12:44:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-10 12:44:37 +0200 |
| commit | 7583258b618a4b651bb2fa41c12ff1c27de15d18 (patch) | |
| tree | 38893919bbe11b680d468612f844fa8dc9da9dbc /jsonpatch.py | |
| parent | f0a4f51e32c77f9c774c26ef339dbd95cfa8ffa7 (diff) | |
| parent | 845cf4ad5dc2e7ebe2284bb499cbe32136d6f0ab (diff) | |
| download | python-json-patch-7583258b618a4b651bb2fa41c12ff1c27de15d18.tar.gz | |
Merge pull request #65 from thunderstruck47/master
fixing array diff bug (issue #30)
Diffstat (limited to 'jsonpatch.py')
| -rw-r--r-- | jsonpatch.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/jsonpatch.py b/jsonpatch.py index 636e807..b1c56d0 100644 --- a/jsonpatch.py +++ b/jsonpatch.py @@ -175,7 +175,11 @@ def make_patch(src, dst): # TODO: fix patch optimiztion and remove the following check # fix when patch with optimization is incorrect patch = JsonPatch.from_diff(src, dst) - new = patch.apply(src) + try: + new = patch.apply(src) + except JsonPatchConflict: # see TODO + return JsonPatch.from_diff(src, dst, False) + if new != dst: return JsonPatch.from_diff(src, dst, False) @@ -601,7 +605,6 @@ def _longest_common_subseq(src, dst): matrix[i][j] = matrix[i-1][j-1] + 1 if matrix[i][j] > z: z = matrix[i][j] - if matrix[i][j] == z: range_src = (i-z+1, i+1) range_dst = (j-z+1, j+1) else: |
