We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7093cb9 + e17f4f4 commit f1f6409Copy full SHA for f1f6409
tools/cleanup.js
@@ -3,10 +3,16 @@ const fs = require('fs');
3
const Path = require('path');
4
/* eslint-enable */
5
6
-const deleteFolderRecursive = (path) => {
+const sanitizePath = (inputPath) => {
7
+ return Path.normalize(inputPath).replace(/^(\.\.(\/|\\|$))+/, '');
8
+};
9
+
10
+const deleteFolderRecursive = (inputPath) => {
11
+ const path = sanitizePath(inputPath);
12
13
if (fs.existsSync(path)) {
14
fs.readdirSync(path).forEach((file) => {
- const curPath = Path.join(path, file);
15
+ const curPath = Path.join(path, sanitizePath(file));
16
if (fs.lstatSync(curPath).isDirectory()) {
17
deleteFolderRecursive(curPath);
18
} else {
0 commit comments