diff options
| author | Tom Harley | 2018-04-13 17:02:38 +0100 |
|---|---|---|
| committer | Tom Harley | 2018-04-13 17:02:38 +0100 |
| commit | 4bbf7700a53a8ddff5cbb29658fb9270e5fc1da8 (patch) | |
| tree | 2f91e658a94ea91389c586727ceb8383123b321c /src | |
| parent | Fix some tests by adding properties in projects (diff) | |
| parent | fixed template matching in test suite (diff) | |
| download | medicine-4bbf7700a53a8ddff5cbb29658fb9270e5fc1da8.tar.gz medicine-4bbf7700a53a8ddff5cbb29658fb9270e5fc1da8.zip | |
Merge branch ‘trh/gets’ of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/project-code into trh/gets
Diffstat (limited to 'src')
| -rw-r--r-- | src/FileRouter.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/FileRouter.ts b/src/FileRouter.ts index 48ec9c7..b662a9c 100644 --- a/src/FileRouter.ts +++ b/src/FileRouter.ts @@ -257,6 +257,10 @@ const getUserProperties: Middleware = ( req: Request, res: Response, next: NextFunction ): void => { logger.debug('Listing additional properties for a user'); + if (res.locals.user == null) { + next(new RequestError(404, 'user_not_found')); + return; + } res.locals.data = res.locals.user.properties; next(); }; @@ -363,7 +367,9 @@ const postUsername: Middleware = async( logger.debug('Editing user'); user.password = req.params.password; } - user.metadata = req.body; + if (req.body) { + user.metadata = req.body; + } next(); }; |
