mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Minor refactoring of freeURL condition check
Signed-off-by: Nicolas Dietrich <nidi@mailbox.org>
This commit is contained in:
parent
ea52746104
commit
3331c0947c
1 changed files with 6 additions and 4 deletions
|
@ -51,11 +51,13 @@ exports.newNote = function (req, res, body) {
|
||||||
} else if (!config.allowAnonymous) {
|
} else if (!config.allowAnonymous) {
|
||||||
return errors.errorForbidden(res)
|
return errors.errorForbidden(res)
|
||||||
}
|
}
|
||||||
if (config.allowFreeURL && noteId && !config.forbiddenNoteIDs.includes(noteId)) {
|
if (noteId) {
|
||||||
|
if (config.allowFreeURL && !config.forbiddenNoteIDs.includes(noteId)) {
|
||||||
req.alias = noteId
|
req.alias = noteId
|
||||||
} else if (noteId) {
|
} else {
|
||||||
return req.method === 'POST' ? errors.errorForbidden(res) : errors.errorNotFound(res)
|
return req.method === 'POST' ? errors.errorForbidden(res) : errors.errorNotFound(res)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
models.Note.create({
|
models.Note.create({
|
||||||
ownerId: owner,
|
ownerId: owner,
|
||||||
alias: req.alias ? req.alias : null,
|
alias: req.alias ? req.alias : null,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue