mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
Throw error when noteId is empty
Signed-off-by: Tamotsu Takahashi <ttakah+github@gmail.com>
This commit is contained in:
parent
5704ad9c3b
commit
2db114fbff
1 changed files with 2 additions and 2 deletions
|
@ -20,8 +20,8 @@ export function extractNoteIdFromRequestUrl(request: IncomingMessage): string {
|
|||
// The example.org domain should be safe to use according to RFC 6761 §6.5.
|
||||
const url = new URL(request.url, 'https://example.org');
|
||||
const noteId = url.searchParams.get('noteId');
|
||||
if (noteId === null) {
|
||||
throw new Error("Path doesn't contain parameter noteId");
|
||||
if (noteId === null || noteId === '') {
|
||||
throw new Error(`Path doesn't contain parameter noteId: ${request.url}`);
|
||||
} else {
|
||||
return noteId;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue