Revert "fix(modules/pipeline): ensure REST file API parses query parameters"

This reverts commit 043697bddccf2b5f47e649eb885b2ece53a1d825.
This commit is contained in:
Pascal Precht 2018-10-22 10:08:36 +02:00
parent fd67844235
commit 137fbf6b52
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D

View File

@ -28,14 +28,12 @@ class Pipeline {
'get', 'get',
'/embark-api/file', '/embark-api/file',
(req, res) => { (req, res) => {
const queryParams = JSON.parse(req.query.params); if (!fs.existsSync(req.query.path) || !req.query.path.startsWith(fs.dappPath())) {
if (!fs.existsSync(queryParams.path) || !queryParams.path.startsWith(fs.dappPath())) {
return res.send({error: 'Path is invalid'}); return res.send({error: 'Path is invalid'});
} }
const name = path.basename(queryParams.path); const name = path.basename(req.query.path);
const content = fs.readFileSync(queryParams.path, 'utf8'); const content = fs.readFileSync(req.query.path, 'utf8');
res.send({name, content, path: queryParams.path}); res.send({name, content, path: req.query.path});
} }
); );