From de3a4c29476a34eb5db0c736124404113c03fd1a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 9 May 2019 12:37:36 +0000 Subject: [PATCH] [FIX] transifex: correctly escape links This commit corrects two issues: - new lines characters are ignored by transifex when searching (searching on '\n' finds no match) - quotes are ignored by transifex (it used to be escaped with \\) - the text:'...' does not need to be escaped, it is the searched string that must be escaped. For instance, searching on "\n\nThis addon is already installed" used to give: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text%3A%27%0A%0AThis+addon+is+already+installed+on+your+system%27 and it now returns: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text:'This+addon+is+already+installed+on+your+system' Searching on '%s' does not seem to be a number used to give: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text:'%5C%27%25s%5C%27+does+not+seem+to+be+a+number+for+field+%5C%27%25%25%28fi' and it now returns: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text:'%25s+does+not+seem+to+be+a+number+for+field+%25%25%28fi' closes odoo/odoo#33279 Signed-off-by: Martin Trigaux (mat) --- addons/transifex/models/ir_translation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/transifex/models/ir_translation.py b/addons/transifex/models/ir_translation.py index c19f66c39c1..51edae39206 100644 --- a/addons/transifex/models/ir_translation.py +++ b/addons/transifex/models/ir_translation.py @@ -84,8 +84,7 @@ class IrTranslation(models.Model): 'project': project, 'lang': lang_code, 'module': translation.module, - 'src': werkzeug.url_quote_plus( - "text:'" + - translation.source[:50].replace("'", "\\'") + - "'"), + 'src': "text:'" + werkzeug.url_quote_plus( + translation.source[:50].replace("\n", "").replace("'", "") + ) + "'", }