Skip to content

Commit b1d558b

Browse files
committed
Added safegaurd against invalid project id in the method getFileContent
1 parent ab7f427 commit b1d558b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/controllers/file.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function deleteFile(req, res) {
110110

111111
export function getFileContent(req, res) {
112112
Project.findById(req.params.project_id, (err, project) => {
113-
if (err) {
113+
if (err || project == null) {
114114
res.status(404).send({ success: false, message: 'Project with that id does not exist.' });
115115
return;
116116
}

0 commit comments

Comments
 (0)