From 5f03da2f7d07bf9a5cf0ac50c2a54e5afb820a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Wed, 15 Jun 2022 13:47:07 +0000 Subject: [PATCH] [FIX] xml: escape chars in regex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. https://github.com/python-babel/babel/issues/467 https://github.com/python-babel/babel/issues/616 https://github.com/python-babel/babel/issues/640 https://github.com/python-babel/babel/pull/791 closes odoo/o-spreadsheet#1461 X-original-commit: df307ed6a0e79370a8405b902df1e909671fb035 Signed-off-by: Pierre Rousseau (pro) Signed-off-by: Lucas Lefèvre (lul) --- src/xlsx/helpers/xml_helpers.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xlsx/helpers/xml_helpers.ts b/src/xlsx/helpers/xml_helpers.ts index cfca3ca91..5dad01c34 100644 --- a/src/xlsx/helpers/xml_helpers.ts +++ b/src/xlsx/helpers/xml_helpers.ts @@ -25,11 +25,11 @@ export function createXMLFile( function xmlEscape(str: XMLAttributeValue): string { return String(str) - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); + .replace(/\&/g, "&") + .replace(/\/g, ">") + .replace(/\"/g, """) + .replace(/\'/g, "'"); } export function formatAttributes(attrs: XMLAttributes): XMLString {