Skip to content

Commit d86b229

Browse files
ptomatoMs2ger
authored andcommitted
Escape test paths and engine names as well in CI table
Pipe is a legal filename character, so theoretically these could break the table too.
1 parent c31495e commit d86b229

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tools/misc/build-results-comment.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function buildCommentBody({ engines, testResults, errors }) {
101101
}
102102

103103
function buildMarkdownTable(tests, engines, testResults) {
104-
const header = ['Test', ...engines];
104+
const header = ['Test', ...engines].map(sanitizeTableMarkdown);
105105
const lines = ['| ' + header.join(' | ') + ' |'];
106106
lines.push('|' + header.map(() => ' --- ').join('|') + '|');
107107

@@ -111,7 +111,7 @@ function buildMarkdownTable(tests, engines, testResults) {
111111
const result = results[engineKey];
112112
return formatCell(result);
113113
});
114-
lines.push('| ' + [testPath, ...cells].join(' | ') + ' |');
114+
lines.push('| ' + [sanitizeTableMarkdown(testPath), ...cells].join(' | ') + ' |');
115115
}
116116

117117
return lines.join('\n');
@@ -152,11 +152,11 @@ function combineMessages(sloppyMessage, strictMessage) {
152152

153153
function formatFail(message) {
154154
if (!message) return '❌';
155-
return `[❌](## "${sanitizeTooltip(message)}")`;
155+
return `[❌](## "${sanitizeTableMarkdown(message)}")`;
156156
}
157157

158158
// https://spec.commonmark.org/0.31.2/#links
159-
function sanitizeTooltip(text) {
159+
function sanitizeTableMarkdown(text) {
160160
let s = String(text);
161161
if (s.length > 500) s = s.slice(0, 500) + "…";
162162
return s

0 commit comments

Comments
 (0)