Skip to content

Commit e2914db

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 X-original-commit: df307ed
1 parent f5520ee commit e2914db

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
@@ -25,11 +25,11 @@ export function createXMLFile(
2525

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

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

0 commit comments

Comments
 (0)