Bug 1142524

Summary: JST filter does not correctly escape backslashes in string literals
Product: [Fedora] Fedora Reporter: Dan Callaghan <dcallagh>
Component: python-webassetsAssignee: Praveen Kumar <kumarpraveen.nitdgp>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: dcallagh, kumarpraveen.nitdgp, pj.pandit
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-webassets-0.9-4.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-20 23:01:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Callaghan 2014-09-17 00:28:27 UTC
Description of problem:
If a template contains a backslash (for example, as part of a regexp on <input pattern=""/> or anywhere else) the backslash is not escaped when the template is converted to a JavaScript string literal by the JST filter.

Version-Release number of selected component (if applicable):
python-webassets-0.9-1.fc20.noarch

How reproducible:
not easily, but reliably

Steps to Reproduce:
1. Set up a project using webassets JST filter
2. Write a JST template with a backslash, for example: <input pattern="\S+"/>
3. Check the resulting JS file produced by webassets.

Actual results:
window.JST['mytemplate'] = _.template('<input pattern="\S+"/>');

Expected results:
window.JST['mytemplate'] = _.template('<input pattern="\\S+"/>');

Additional info:
Upstream PR that was merged for 0.10:
https://github.com/miracle2k/webassets/pull/284

The patch applies cleanly to 0.9.
https://github.com/danc86/webassets/commit/fad3aded6837751f68b6f3af6851ef19c64dd04c.patch

Comment 1 Fedora Update System 2014-11-10 11:51:08 UTC
python-webassets-0.9-4.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/python-webassets-0.9-4.el7

Comment 2 Fedora Update System 2014-11-10 11:52:51 UTC
python-webassets-0.9-4.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/python-webassets-0.9-4.fc20

Comment 3 Fedora Update System 2014-11-10 11:53:59 UTC
python-webassets-0.9-4.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/python-webassets-0.9-4.fc19

Comment 4 Fedora Update System 2014-11-12 02:43:20 UTC
Package python-webassets-0.9-4.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-webassets-0.9-4.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-14770/python-webassets-0.9-4.fc20
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2014-11-20 23:01:34 UTC
python-webassets-0.9-4.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2014-11-20 23:02:52 UTC
python-webassets-0.9-4.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2014-11-25 20:08:48 UTC
python-webassets-0.9-4.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.