Merge pull request #1265 from thegitone23/local-develop
Added safegaurd against invalid project id and undefined file path
This commit is contained in:
commit
7f8ab3cded
2 changed files with 5 additions and 1 deletions
|
@ -111,7 +111,7 @@ export function deleteFile(req, res) {
|
|||
|
||||
export function getFileContent(req, res) {
|
||||
Project.findById(req.params.project_id, (err, project) => {
|
||||
if (err) {
|
||||
if (err || project === null) {
|
||||
res.status(404).send({ success: false, message: 'Project with that id does not exist.' });
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
export function resolvePathToFile(filePath, files) {
|
||||
if (filePath === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const filePathArray = filePath.split('/');
|
||||
let resolvedFile;
|
||||
let currentFile = files.find(file => file.name === 'root');
|
||||
|
|
Loading…
Reference in a new issue