A library with support functions to be called from Odoo migration scripts.
GNU Affero General Public License v3.0
85
stars
171
forks
source link
[IMP] convert_html_fragment: prevent lxml wraps and false positives #349
Closed
chienandalu closed 10 months ago
When the fragment has no common node, lxml wraps the code under a common one. This content for instance:
is parsed as:
To avoid this we force a custom wrapper tag on every parsed string so every xml receives the same treatment and we can extract it later with no harm.
We don't want to update any fragment which has no changes after all the replacements are checked. For that cases we'll return the original string.
At the end, we just trim our initial custom wrapper tag and return our treated string.
I made this test case and tested it in a v16 shell:
cc @Tecnativa TT44169 TT45734
please take a look @pedrobaeza