mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
* Check template name when rendering also * Update i18n.py Enforce stringiness (cherry picked from commit b42f3de3577f754c76c5a8afb0d93d632cc1e439) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
c12e6dbf42
commit
9494a8ad43
@ -52,7 +52,18 @@ class CustomTranslateNode(TranslateNode):
|
|||||||
# Escape any quotes contained in the string, if the request is for a javascript file
|
# Escape any quotes contained in the string, if the request is for a javascript file
|
||||||
request = context.get('request', None)
|
request = context.get('request', None)
|
||||||
|
|
||||||
if self.escape or (request and request.path.endswith('.js')):
|
template = getattr(context, 'template_name', None)
|
||||||
|
request = context.get('request', None)
|
||||||
|
|
||||||
|
escape = self.escape
|
||||||
|
|
||||||
|
if template and str(template).endswith('.js'):
|
||||||
|
escape = True
|
||||||
|
|
||||||
|
if request and str(request.path).endswith('.js'):
|
||||||
|
escape = True
|
||||||
|
|
||||||
|
if escape:
|
||||||
result = result.replace("'", r'\'')
|
result = result.replace("'", r'\'')
|
||||||
result = result.replace('"', r'\"')
|
result = result.replace('"', r'\"')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user