Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when saving URL in diff #43

Open
flippyang opened this issue Jun 19, 2019 · 4 comments
Open

Problem when saving URL in diff #43

flippyang opened this issue Jun 19, 2019 · 4 comments

Comments

@flippyang
Copy link

flippyang commented Jun 19, 2019

I have this document where i saved the URL and sources in array of object. Here is an example of how my json look like:

{
"data":
[
  {
     "firstName":"John",
     "lastName":"Doe",
     "sources": [{
             "url": "https://www.successcds.net/learn-english/articles-definition-examples-types-exercises.html",
              "title":"URL example",
          },
          {
              "url": "https://websitebuilders.com/how-to/web-at-a-glance/url-examples/",
              "title":"URL example 2"
          }
]
} 

This is what happened in diff when I try to edit and save the url from
https://websitebuilders.com/how-to/web-at-a-glance/url-examples/ to https://websitebuilders.com/how-to/web-at-a-glance/url-examples/#Example_1httpswebsitebuilderscom:

{
    "diff":{
          "sources": {"1": "url": ["@@-57,8+57,41@@xamples/+#Example_1httpswebsitebuilderscom", "0",  "2"]}
     }
} 

If you notice, the url are completely butchered. It seems like it combines both url (original and updated) into one encoded url. Somehow it happen to some of the url only especially the long one. Can you check please?

@dhwpong
Copy link
Contributor

dhwpong commented Jun 19, 2019

Take a look at
https://benjamine.github.io/jsondiffpatch/demo/
I think u are looking at the patch difference.
For reverse applying it to get back the previous version

@zjr
Copy link
Collaborator

zjr commented Apr 24, 2020

@flippyang do you still have an issue?

@ru4ert
Copy link

ru4ert commented Jul 24, 2021

I don't have this issue.

@AlexandrMoroz
Copy link

If you want to save without text diff. You need to path textDiff option to jsondiffpatch
const diffPatcher = require('jsondiffpatch').create({ objectHash, textDiff:{minLength:1000} });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants