@@ -4648,7 +4648,8 @@ const github = __importStar(__webpack_require__(469));
4648
4648
const filter_1 = __webpack_require__(235);
4649
4649
const file_1 = __webpack_require__(258);
4650
4650
const git = __importStar(__webpack_require__(136));
4651
- const shell_escape_1 = __webpack_require__(751);
4651
+ const shell_escape_1 = __webpack_require__(206);
4652
+ const csv_escape_1 = __webpack_require__(410);
4652
4653
async function run() {
4653
4654
try {
4654
4655
const workingDirectory = core.getInput('working-directory', { required: false });
@@ -4825,18 +4826,20 @@ function exportResults(results, format) {
4825
4826
function serializeExport(files, format) {
4826
4827
const fileNames = files.map(file => file.filename);
4827
4828
switch (format) {
4829
+ case 'csv':
4830
+ return fileNames.map(csv_escape_1.csvEscape).join(',');
4828
4831
case 'json':
4829
4832
return JSON.stringify(fileNames);
4830
4833
case 'escape':
4831
- return fileNames.map(shell_escape_1.escape ).join(' ');
4834
+ return fileNames.map(shell_escape_1.backslashEscape ).join(' ');
4832
4835
case 'shell':
4833
4836
return fileNames.map(shell_escape_1.shellEscape).join(' ');
4834
4837
default:
4835
4838
return '';
4836
4839
}
4837
4840
}
4838
4841
function isExportFormat(value) {
4839
- return value === 'none' || value === 'shell' || value === 'json' || value === 'escape';
4842
+ return [ 'none', 'csv', 'shell', 'json', 'escape'].includes(value) ;
4840
4843
}
4841
4844
run();
4842
4845
@@ -5028,6 +5031,43 @@ module.exports = {
5028
5031
};
5029
5032
5030
5033
5034
+ /***/ }),
5035
+
5036
+ /***/ 206:
5037
+ /***/ (function(__unusedmodule, exports) {
5038
+
5039
+ "use strict";
5040
+
5041
+ Object.defineProperty(exports, "__esModule", { value: true });
5042
+ exports.shellEscape = exports.backslashEscape = void 0;
5043
+ // Backslash escape every character except small subset of definitely safe characters
5044
+ function backslashEscape(value) {
5045
+ return value.replace(/([^a-zA-Z0-9,._+:@%/-])/gm, '\\$1');
5046
+ }
5047
+ exports.backslashEscape = backslashEscape;
5048
+ // Returns filename escaped for usage as shell argument.
5049
+ // Applies "human readable" approach with as few escaping applied as possible
5050
+ function shellEscape(value) {
5051
+ if (value === '')
5052
+ return value;
5053
+ // Only safe characters
5054
+ if (/^[a-zA-Z0-9,._+:@%/-]+$/m.test(value)) {
5055
+ return value;
5056
+ }
5057
+ if (value.includes("'")) {
5058
+ // Only safe characters, single quotes and white-spaces
5059
+ if (/^[a-zA-Z0-9,._+:@%/'\s-]+$/m.test(value)) {
5060
+ return `"${value}"`;
5061
+ }
5062
+ // Split by single quote and apply escaping recursively
5063
+ return value.split("'").map(shellEscape).join("\\'");
5064
+ }
5065
+ // Contains some unsafe characters but no single quote
5066
+ return `'${value}'`;
5067
+ }
5068
+ exports.shellEscape = shellEscape;
5069
+
5070
+
5031
5071
/***/ }),
5032
5072
5033
5073
/***/ 211:
@@ -8813,6 +8853,33 @@ function Octokit(plugins, options) {
8813
8853
}
8814
8854
8815
8855
8856
+ /***/ }),
8857
+
8858
+ /***/ 410:
8859
+ /***/ (function(__unusedmodule, exports) {
8860
+
8861
+ "use strict";
8862
+
8863
+ Object.defineProperty(exports, "__esModule", { value: true });
8864
+ exports.csvEscape = void 0;
8865
+ // Returns filename escaped for CSV
8866
+ // Wraps file name into "..." only when it contains some potentially unsafe character
8867
+ function csvEscape(value) {
8868
+ if (value === '')
8869
+ return value;
8870
+ // Only safe characters
8871
+ if (/^[a-zA-Z0-9._+:@%/-]+$/m.test(value)) {
8872
+ return value;
8873
+ }
8874
+ // https://tools.ietf.org/html/rfc4180
8875
+ // If double-quotes are used to enclose fields, then a double-quote
8876
+ // appearing inside a field must be escaped by preceding it with
8877
+ // another double quote
8878
+ return `"${value.replace(/"/g, '""')}"`;
8879
+ }
8880
+ exports.csvEscape = csvEscape;
8881
+
8882
+
8816
8883
/***/ }),
8817
8884
8818
8885
/***/ 413:
@@ -15225,43 +15292,6 @@ function sync (path, options) {
15225
15292
15226
15293
module.exports = require("fs");
15227
15294
15228
- /***/ }),
15229
-
15230
- /***/ 751:
15231
- /***/ (function(__unusedmodule, exports) {
15232
-
15233
- "use strict";
15234
-
15235
- Object.defineProperty(exports, "__esModule", { value: true });
15236
- exports.shellEscape = exports.escape = void 0;
15237
- // Backslash escape every character except small subset of definitely safe characters
15238
- function escape(value) {
15239
- return value.replace(/([^a-zA-Z0-9,._+:@%/-])/gm, '\\$1');
15240
- }
15241
- exports.escape = escape;
15242
- // Returns filename escaped for usage as shell argument.
15243
- // Applies "human readable" approach with as few escaping applied as possible
15244
- function shellEscape(value) {
15245
- if (value === '')
15246
- return value;
15247
- // Only safe characters
15248
- if (/^[a-zA-Z0-9,._+:@%/-]+$/m.test(value)) {
15249
- return value;
15250
- }
15251
- if (value.includes("'")) {
15252
- // Only safe characters, single quotes and white-spaces
15253
- if (/^[a-zA-Z0-9,._+:@%/'\s-]+$/m.test(value)) {
15254
- return `"${value}"`;
15255
- }
15256
- // Split by single quote and apply escaping recursively
15257
- return value.split("'").map(shellEscape).join("\\'");
15258
- }
15259
- // Contains some unsafe characters but no single quote
15260
- return `'${value}'`;
15261
- }
15262
- exports.shellEscape = shellEscape;
15263
-
15264
-
15265
15295
/***/ }),
15266
15296
15267
15297
/***/ 753:
0 commit comments