Skip to content

Commit 28a82a7

Browse files
Merge pull request #96 from webnexusmobile/master
Added html escaping for opening and closing brackets in embedded text
2 parents d76b629 + 13df93f commit 28a82a7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/generate-report.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ function generateReport(options) {
334334
]);
335335
} else if (embedding.mime_type === 'text/plain' || (embedding.media && embedding.media.type === 'text/plain')) {
336336
step.text = (step.text ? step.text : []).concat([
337-
_isBase64(embedding.data) ? Base64.decode(embedding.data) :
337+
_isBase64(embedding.data) ? _escapeHtml(Base64.decode(embedding.data)) :
338338
embedding.data
339339
]);
340340
} else if (embedding.mime_type === 'image/png' || (embedding.media && embedding.media.type === 'image/png')) {
@@ -435,6 +435,16 @@ function generateReport(options) {
435435
(firstPaddingChar === stringLength - 2 && string[ stringLength - 1 ] === '=');
436436
}
437437

438+
/**
439+
* Escape html in string
440+
* @param string
441+
* @return {string}
442+
* @private
443+
*/
444+
function _escapeHtml(string) {
445+
return string.replace(/</g, '&lt;').replace(/>/g, '&gt;')
446+
}
447+
438448
/**
439449
* Generate the features overview
440450
* @param {object} suite JSON object with all the features and scenarios

templates/components/scenarios.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
<% } %>
160160

161161
<% if (step.image) { %>
162-
<a href="#info<%= scenarioIndex %><%= stepIndex %>-image" data-toggle="collapse">Screenshot +</a>
162+
<a href="#info<%= scenarioIndex %><%= stepIndex %>-image" data-toggle="collapse">+ Screenshot</a>
163163
<% } %>
164164

165165
<% if (!_.isEmpty(step.attachments)) { %>

0 commit comments

Comments
 (0)