Fix HTML parsing bug when </script> is in the phantomas results json
This commit is contained in:
@@ -34,9 +34,14 @@ var resultsController = function(req, res, googleAnalyticsId) {
|
||||
return res.status(404).send('Sorry, test not found...');
|
||||
}
|
||||
|
||||
// Escape "</script>" because it can interfer with the HTML parser
|
||||
var phantomasResults = results.phantomasResults;
|
||||
phantomasResults = phantomasResults.replace('</script>', '\\u003c/script>');
|
||||
|
||||
|
||||
var html = results.htmlTemplate;
|
||||
html = html.replace('%%METADATA%%', results.phantomasMetadata);
|
||||
html = html.replace('%%RESULTS%%', results.phantomasResults);
|
||||
html = html.replace('%%RESULTS%%', phantomasResults);
|
||||
html = html.replace('%%GA_ID%%', googleAnalyticsId);
|
||||
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
Reference in New Issue
Block a user