Skip to content

Commit

Permalink
site: support new folder structure in REPL (#2945)
Browse files Browse the repository at this point in the history
* site: support files in directories in /repl/local/

* site: bump @sveltejs/svelte-repl
  • Loading branch information
Conduitry committed Jun 4, 2019
1 parent f7e6b32 commit 86c08c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@babel/runtime": "^7.4.4",
"@sindresorhus/slugify": "^0.9.1",
"@sveltejs/site-kit": "^1.0.4",
"@sveltejs/svelte-repl": "^0.1.2",
"@sveltejs/svelte-repl": "^0.1.5",
"degit": "^2.1.3",
"dotenv": "^8.0.0",
"eslint-plugin-svelte3": "^1.0.0",
Expand Down
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 86c08c6

Please sign in to comment.