Skip to content

Commit

Permalink
chore(v3): add sanitize-filename to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoazh committed Apr 25, 2024
1 parent cbc1fe0 commit f8cb149
Show file tree
Hide file tree
Showing 3 changed files with 347 additions and 290 deletions.
3 changes: 2 additions & 1 deletion packages/v3/cypress/runner/runner.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const http = require('http');
const fs = require('fs/promises');
const path = require('path');
var sanitize = require('sanitize-filename');
require('dotenv').config({ path: path.resolve(__dirname, '.env') });

const port = process.env.PORT || 4173;
Expand All @@ -14,7 +15,7 @@ const server = http.createServer(async (req, res) => {
: !/^https?:\/\//gim.test(req.url)
? path.join(baseUrl, req.url)
: req.url;
filePath = await fs.realpath(path.resolve(root, filePath));
filePath = await fs.realpath(path.resolve(root, sanitize(filePath)));

if (filePath.startsWith(root)) {
res.statusCode = 403;
Expand Down
1 change: 1 addition & 0 deletions packages/v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"sanitize-filename": "^1.6.3",
"semantic-release": "^23.0.6",
"semantic-release-cli": "^5.4.6",
"start-server-and-test": "^2.0.3",
Expand Down
Loading

0 comments on commit f8cb149

Please sign in to comment.