From 15374acb9358bbe92cfd8e86f5642a10a15ddbec Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Fri, 31 Mar 2023 15:34:57 +0200 Subject: [PATCH] fix(backend): throw error if key in param decorator is not defined Signed-off-by: Tilman Vatteroth --- backend/src/api/utils/markdown-body.decorator.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/api/utils/markdown-body.decorator.ts b/backend/src/api/utils/markdown-body.decorator.ts index f716390bc..75dbf8eec 100644 --- a/backend/src/api/utils/markdown-body.decorator.ts +++ b/backend/src/api/utils/markdown-body.decorator.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -41,6 +41,11 @@ export const MarkdownBody = createParamDecorator( }, [ (target, key): void => { + if (key === undefined) { + throw new Error( + `Could not enhance param decorator for target ${target.toString()} because key is undefined`, + ); + } const ownPropertyDescriptor = Object.getOwnPropertyDescriptor( target, key,