Skip to content

Commit

Permalink
site: support files in directories in /repl/local/
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Jun 3, 2019
1 parent f7e6b32 commit 3dbf7d8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createReadStream } from 'fs';

export function get(req, res) {
if (process.env.NODE_ENV !== 'development' || !/^[a-z.]+$/.test(req.params.file)) {
const path = req.params.file.join('/');
if (process.env.NODE_ENV !== 'development' || ('/' + path).includes('/.')) {
res.writeHead(403);
res.end();
return;
}
createReadStream('../' + req.params.file)
createReadStream('../' + path)
.on('error', () => {
res.writeHead(403);
res.end();
Expand Down

0 comments on commit 3dbf7d8

Please sign in to comment.