aboutsummaryrefslogtreecommitdiff
path: root/src/FileRouter.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/FileRouter.ts')
-rw-r--r--src/FileRouter.ts8
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();
};