From f2b59b2836eef6887c4e47a7d39987781a1742ca Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Tue, 23 Jan 2024 10:13:27 +0100 Subject: [PATCH] fix #1280 --- src/librssguard/database/databasequeries.cpp | 2 ++ src/librssguard/services/standard/parsers/jsonparser.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/librssguard/database/databasequeries.cpp b/src/librssguard/database/databasequeries.cpp index d508d3673..96a77d740 100644 --- a/src/librssguard/database/databasequeries.cpp +++ b/src/librssguard/database/databasequeries.cpp @@ -564,6 +564,7 @@ bool DatabaseQueries::removeUnwantedArticlesFromFeed(const QSqlDatabase& db, // No articles will be removed, quitting. return false; } + // We find datetime stamp of oldest article which will be NOT moved/removed. QSqlQuery q(db); @@ -576,6 +577,7 @@ bool DatabaseQueries::removeUnwantedArticlesFromFeed(const QSqlDatabase& db, " Messages.is_pdeleted = 0 " "ORDER BY Messages.date_created DESC " "LIMIT 1 OFFSET :offset;")); + q.bindValue(QSL(":offset"), amount_to_keep - 1); q.bindValue(QSL(":feed"), feed->customId()); diff --git a/src/librssguard/services/standard/parsers/jsonparser.cpp b/src/librssguard/services/standard/parsers/jsonparser.cpp index 027b58a16..02364299c 100644 --- a/src/librssguard/services/standard/parsers/jsonparser.cpp +++ b/src/librssguard/services/standard/parsers/jsonparser.cpp @@ -123,6 +123,10 @@ QPair> JsonParser::guessFeed(const QByteArray throw FeedRecognizedButFailedException(QObject::tr("JSON error '%1'").arg(json_err.errorString())); } + if (!json.object().contains(QSL("version"))) { + throw ApplicationException(QObject::tr("not a JSON feed")); + } + auto* feed = new StandardFeed(); QList icon_possible_locations;