diff --git a/changelog.d/attrs-parsing.fix b/changelog.d/attrs-parsing.fix new file mode 100644 index 000000000..e36e59a86 --- /dev/null +++ b/changelog.d/attrs-parsing.fix @@ -0,0 +1 @@ +Fix HTML attribute parsing for escaped quotes \ No newline at end of file diff --git a/src/services/html_converter/utility.service.js b/src/services/html_converter/utility.service.js index 5cdcf33cd..4c36eda2f 100644 --- a/src/services/html_converter/utility.service.js +++ b/src/services/html_converter/utility.service.js @@ -23,7 +23,7 @@ export const getAttrs = (tag, filter) => { .replace(/\/?$/, '') .trim() const attrs = Array.from( - innertag.matchAll(/([a-z]+[a-z0-9-]*)(?:=("[^"]+?"|'[^']+?'))?/gi), + innertag.matchAll(/([a-z]+[a-z0-9-]*)(?:=((?:"(?:\\.|[^"\\])*")|(?:'(?:\\.|[^'\\])*')))?/gi), ) .map(([, key, value]) => [key, value]) .map(([k, v]) => {