Skip to content

Commit c45e947

Browse files
committed
[FIX] xml: escape chars in regex
There's an issue in odoo when extracing translatable source terms from the bundled library file `o_spreadsheet.js`. Some terms are not extracted. Babel doesn't correctly tokenize the regex /"/ As a result, all following tokens are fucked up and source terms are no longer exported after this point. It seems to be known that babel js lexer isn't perfect. python-babel/babel#467 python-babel/babel#616 python-babel/babel#640 python-babel/babel#791 closes #1464 X-original-commit: d711ad2 Signed-off-by: Pierre Rousseau (pro) <[email protected]> Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
1 parent ec521a6 commit c45e947

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/xlsx/helpers/xml_helpers.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export function createXMLFile(
2626

2727
function xmlEscape(str: XMLAttributeValue): string {
2828
return String(str)
29-
.replace(/&/g, "&amp;")
30-
.replace(/</g, "&lt;")
31-
.replace(/>/g, "&gt;")
32-
.replace(/"/g, "&quot;")
33-
.replace(/'/g, "&apos;");
29+
.replace(/\&/g, "&amp;")
30+
.replace(/\</g, "&lt;")
31+
.replace(/\>/g, "&gt;")
32+
.replace(/\"/g, "&quot;")
33+
.replace(/\'/g, "&apos;");
3434
}
3535

3636
export function formatAttributes(attrs: XMLAttributes): XMLString {

0 commit comments

Comments
 (0)