mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
feat: checkNoteIdOrAlias in more alias service methods
This should prevent any interaction by a forbidden id Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
6269c7f7bc
commit
c891a95588
4 changed files with 17 additions and 17 deletions
|
@ -157,20 +157,15 @@ export class NotesService {
|
|||
* @param {string} noteIdOrAlias - the notes id or alias
|
||||
* @return {Note} the note
|
||||
* @throws {NotInDBError} there is no note with this id or alias
|
||||
* @throws {ForbiddenIdError} the requested id or alias is forbidden
|
||||
*/
|
||||
async getNoteByIdOrAlias(noteIdOrAlias: string): Promise<Note> {
|
||||
this.logger.debug(
|
||||
`Trying to find note '${noteIdOrAlias}'`,
|
||||
'getNoteByIdOrAlias',
|
||||
);
|
||||
try {
|
||||
this.checkNoteIdOrAlias(noteIdOrAlias);
|
||||
} catch (e) {
|
||||
if (e instanceof ForbiddenIdError) {
|
||||
throw new NotInDBError(e.message);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
this.checkNoteIdOrAlias(noteIdOrAlias);
|
||||
|
||||
/**
|
||||
* This query gets the note's aliases, owner, groupPermissions (and the groups), userPermissions (and the users) and tags and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue