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

HTML alphanumeric values breaking local - remote equality check #44

Open
DazEdword opened this issue Aug 25, 2023 · 4 comments
Open

HTML alphanumeric values breaking local - remote equality check #44

DazEdword opened this issue Aug 25, 2023 · 4 comments

Comments

@DazEdword
Copy link

I've been using cosmere as part of a CICD pipeline, and experienced an unexplained issue: every time I'd be notified of changes in a document that, upon inspection, had no changes at all. This would happen in several documents, and comparing document versions in Confluence yielded no visible changes.

After tinkering and debugging, I'm positive this is due to html characters breaking the equality check here:

Line 48, src/UpdatePage.ts

function isRemoteUpdateRequired(newContent: string, confluencePage: any): boolean {
    const local = removeDynamicIds(newContent).trim().replace(/'/g, "'");
    const remote = removeDynamicIds(confluencePage.body.storage.value).trim();
    return local !== remote;
}

As you can see, the replace is only covering single quotes. However, any other HTML symbol is ignored, and as such it's interpreted as a different document, hence being re-uploaded. I've experienced this with other symbols such as &ndash;, &ldquo; and many others. Also, line breaks are showing as <br/> locally and <br /> remotely (note the whitespace).

Hopefully, a more thorough logic when comparing local and remotely will help with the issue.

@mihaeu
Copy link
Owner

mihaeu commented Aug 25, 2023

Hi Eduardo, thanks for the issue and thanks for all the upfront reasearch 🤗

Was bound to happen at some point. I'm surprised I didn't run into this earlier or maybe it was because it's hard figuring out if you're in a code block or not when you're not actually inside a parser. Maybe different Confluence versions. I'll try to figure out how to do this properly. I'll write the tests and maybe you can have a look if I missed some test cases.

@DazEdword
Copy link
Author

No problem, happy to contribute! Feel free to add me as a reviewer when the time comes 👍 .

@DazEdword
Copy link
Author

Hi again @mihaeu! There's a chance that my employer can allocate some time for me to contribute to the project if you'd like to have support with this issue. Let me know if that's the case, if you prefer you can reach out via the site in my profile 👋

@mihaeu
Copy link
Owner

mihaeu commented Aug 29, 2023

Sounds amazing, will do 👍

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

2 participants