From c6d8188e4e33ba682551a3ca79205ff5a6d7ead5 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Mon, 25 Mar 2024 19:12:27 +0100 Subject: [PATCH] fix: error in logs if "allow unauthenticated shares" is enabled --- backend/src/user/user.controller.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index b55ea66..f591423 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -27,7 +27,8 @@ export class UserController { // Own user operations @Get("me") @UseGuards(JwtGuard) - async getCurrentUser(@GetUser() user: User) { + async getCurrentUser(@GetUser() user?: User) { + if (!user) return null; const userDTO = new UserDTO().from(user); userDTO.hasPassword = !!user.password; return userDTO;