mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Return 404 if the comic is not found
This commit is contained in:
parent
c5924e625b
commit
a3f3149764
@ -57,6 +57,12 @@ void ComicControllerV2::service(HttpRequest &request, HttpResponse &response)
|
|||||||
|
|
||||||
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
|
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
|
||||||
|
|
||||||
|
if (!comic.info.existOnDb) {
|
||||||
|
response.setStatus(404, "Not Found");
|
||||||
|
response.write("", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Comic *comicFile = FactoryComic::newComic(libraries.getPath(libraryId) + comic.path);
|
Comic *comicFile = FactoryComic::newComic(libraries.getPath(libraryId) + comic.path);
|
||||||
|
|
||||||
if (comicFile != nullptr) {
|
if (comicFile != nullptr) {
|
||||||
|
@ -44,6 +44,12 @@ void ComicControllerInReadingListV2::service(HttpRequest &request, HttpResponse
|
|||||||
|
|
||||||
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
|
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
|
||||||
|
|
||||||
|
if (!comic.info.existOnDb) {
|
||||||
|
response.setStatus(404, "Not Found");
|
||||||
|
response.write("", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Comic *comicFile = FactoryComic::newComic(libraries.getPath(libraryId) + comic.path);
|
Comic *comicFile = FactoryComic::newComic(libraries.getPath(libraryId) + comic.path);
|
||||||
|
|
||||||
if (comicFile != nullptr) {
|
if (comicFile != nullptr) {
|
||||||
|
@ -22,6 +22,12 @@ void ComicDownloadInfoControllerV2::service(HttpRequest &request, HttpResponse &
|
|||||||
|
|
||||||
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
|
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
|
||||||
|
|
||||||
|
if (!comic.info.existOnDb) {
|
||||||
|
response.setStatus(404, "Not Found");
|
||||||
|
response.write("", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: check if the comic wasn't found;
|
// TODO: check if the comic wasn't found;
|
||||||
response.write(QString("fileName:%1\r\n").arg(comic.getFileName()).toUtf8());
|
response.write(QString("fileName:%1\r\n").arg(comic.getFileName()).toUtf8());
|
||||||
response.write(QString("fileSize:%1\r\n").arg(comic.getFileSize()).toUtf8());
|
response.write(QString("fileSize:%1\r\n").arg(comic.getFileSize()).toUtf8());
|
||||||
|
@ -26,9 +26,6 @@ void ComicFullinfoController_v2::service(HttpRequest &request, HttpResponse &res
|
|||||||
qulonglong comicId = pathElements.at(5).toULongLong();
|
qulonglong comicId = pathElements.at(5).toULongLong();
|
||||||
|
|
||||||
serviceContent(libraryId, comicId, response);
|
serviceContent(libraryId, comicId, response);
|
||||||
|
|
||||||
response.setStatus(200, "OK");
|
|
||||||
response.write("", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComicFullinfoController_v2::serviceContent(const int &libraryId, const qulonglong &comicId, HttpResponse &response)
|
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);
|
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);
|
QJsonObject json = YACReaderServerDataHelper::fullComicToJSON(libraryId, libraryUuid, comic);
|
||||||
|
|
||||||
QJsonDocument output(json);
|
QJsonDocument output(json);
|
||||||
|
|
||||||
response.write(output.toJson(QJsonDocument::Compact));
|
response.write(output.toJson(QJsonDocument::Compact));
|
||||||
|
|
||||||
|
response.setStatus(200, "OK");
|
||||||
|
response.write("", true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user