From f1eed842d265fcd13cf7d80c5ac58337488271f0 Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Sat, 25 Apr 2020 18:45:15 +0200 Subject: [PATCH] Fix 404 logic --- api/src/routing/TitleController.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/routing/TitleController.kt b/api/src/routing/TitleController.kt index af8e476..8c71777 100644 --- a/api/src/routing/TitleController.kt +++ b/api/src/routing/TitleController.kt @@ -34,7 +34,7 @@ fun Routing.title(kodein: Kodein) { val noteUuid = call.parameters.noteUuid() val exists = notesService.noteExists(userId, noteUuid) - if (exists) return@patch call.respondStatus(HttpStatusCode.NotFound) + if (!exists) return@patch call.respondStatus(HttpStatusCode.NotFound) val notePatch = call.receiveNotePatch().copy(uuid = noteUuid) @@ -47,7 +47,7 @@ fun Routing.title(kodein: Kodein) { val noteUuid = call.parameters.noteUuid() val exists = notesService.noteExists(userId, noteUuid) - if (exists) return@delete call.respondStatus(HttpStatusCode.NotFound) + if (!exists) return@delete call.respondStatus(HttpStatusCode.NotFound) notesService.deleteNote(noteUuid) call.respondStatus(HttpStatusCode.OK)