diff options
author | Nicolas Dietrich | 2021-01-22 15:36:47 +0100 |
---|---|---|
committer | Nicolas Dietrich | 2021-01-22 16:52:49 +0100 |
commit | 3331c0947cb6d63ce7f2846c38d5a7b82960b2eb (patch) | |
tree | 9a15701a1c057bcd81769baeed6d9588e01a3692 /lib | |
parent | ea5274610467be21b3001dc98f344909baf3ac2b (diff) |
Minor refactoring of freeURL condition check
Signed-off-by: Nicolas Dietrich <nidi@mailbox.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/web/note/util.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/web/note/util.js b/lib/web/note/util.js index 9c6c1c8a..75f0c815 100644 --- a/lib/web/note/util.js +++ b/lib/web/note/util.js @@ -51,10 +51,12 @@ exports.newNote = function (req, res, body) { } else if (!config.allowAnonymous) { return errors.errorForbidden(res) } - if (config.allowFreeURL && noteId && !config.forbiddenNoteIDs.includes(noteId)) { - req.alias = noteId - } else if (noteId) { - return req.method === 'POST' ? errors.errorForbidden(res) : errors.errorNotFound(res) + if (noteId) { + if (config.allowFreeURL && !config.forbiddenNoteIDs.includes(noteId)) { + req.alias = noteId + } else { + return req.method === 'POST' ? errors.errorForbidden(res) : errors.errorNotFound(res) + } } models.Note.create({ ownerId: owner, |