Return 404 if the comic is not found

This commit is contained in:
Luis Ángel San Martín
2024-08-29 19:01:48 +02:00
parent c5924e625b
commit a3f3149764
4 changed files with 27 additions and 3 deletions

View File

@ -26,9 +26,6 @@ void ComicFullinfoController_v2::service(HttpRequest &request, HttpResponse &res
qulonglong comicId = pathElements.at(5).toULongLong();
serviceContent(libraryId, comicId, response);
response.setStatus(200, "OK");
response.write("", true);
}
void ComicFullinfoController_v2::serviceContent(const int &libraryId, const qulonglong &comicId, HttpResponse &response)
@ -37,9 +34,18 @@ void ComicFullinfoController_v2::serviceContent(const int &libraryId, const qulo
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
if (!comic.info.existOnDb) {
response.setStatus(404, "Not Found");
response.write("", true);
return;
}
QJsonObject json = YACReaderServerDataHelper::fullComicToJSON(libraryId, libraryUuid, comic);
QJsonDocument output(json);
response.write(output.toJson(QJsonDocument::Compact));
response.setStatus(200, "OK");
response.write("", true);
}