AuthorManager: prevent generation of an author in case no token was specified

refactoring
webzwo0i 2021-06-18 15:16:27 +02:00
parent 32806c31fd
commit dbfe5cadf4
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,10 @@ exports.doesAuthorExists = exports.doesAuthorExist;
* @param {String} token The token
*/
exports.getAuthor4Token = async (token) => {
// e.g. in case of an export of a public pad, a token is not needed
if (token == null) {
return;
}
const author = await mapAuthorWithDBKey('token2author', token);
// return only the sub value authorID