Skip to content

Invalid comparison result when the value contains more than 60 characters #248

@kiichi

Description

@kiichi

If comparing value's string size exceed the more than textdiff limit, the diff result will spill out patch syntax.

Reproducible Steps

  1. Go to live demo (https://benjamine.github.io/jsondiffpatch/demo/index.html)
  2. Paste the following json string
{
	"hello": "X one two three four five six seven eight nine ten eleven (ABC)"
}
  1. Change first few characters
  2. You will see wrong comparison result such as
{
  "hello": [
    "@@ -1,5 +1,5 @@\n-X\n+Y\n  one\n",
    0,
    2
  ]
}

Please note that the live demo has default textDiff limit which is 60.

Note

To avoid this, I simply set textDiff option very large so that it wouldn't spill out.

textDiff: {
    minLength:1000 
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions