Skip to content

Commit 4fde999

Browse files
author
Martin Rotter
committed
report error when downloaded icon failed
1 parent 29fc83e commit 4fde999

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/librssguard/services/tt-rss/ttrssnetworkfactory.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,9 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons, co
681681
auto* parent = new RootItem();
682682

683683
// Chop the "api/" from the end of the address.
684-
qDebug("TT-RSS: Base address to '%s' to get feed icons.", qPrintable(base_address));
684+
qDebugNN << LOGSEC_TTRSS
685+
<< "Base address to get feed icons is"
686+
<< QUOTE_W_SPACE_DOT(base_address);
685687

686688
if (status() == TTRSS_API_STATUS_OK) {
687689
// We have data, construct object tree according to data.
@@ -731,22 +733,26 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons, co
731733
// We have feed.
732734
auto* feed = new TtRssFeed();
733735

734-
IOFactory::writeFile("aa.json", QJsonDocument(item).toJson());
735-
736736
if (obtain_icons) {
737737
QString icon_path = item[QSL("icon")].type() == QJsonValue::String ? item[QSL("icon")].toString() : QString();
738738

739739
if (!icon_path.isEmpty()) {
740740
// Chop the "api/" suffix out and append
741741
QString full_icon_address = base_address + QL1C('/') + icon_path;
742742
QIcon icon;
743+
auto res = NetworkFactory::downloadIcon({ { full_icon_address, true } },
744+
DOWNLOAD_TIMEOUT,
745+
icon,
746+
proxy);
743747

744-
if (NetworkFactory::downloadIcon({ { full_icon_address, true } },
745-
DOWNLOAD_TIMEOUT,
746-
icon,
747-
proxy) == QNetworkReply::NoError) {
748+
if (res == QNetworkReply::NoError) {
748749
feed->setIcon(icon);
749750
}
751+
else {
752+
qWarningNN << LOGSEC_TTRSS
753+
<< "Failed to download icon with error"
754+
<< QUOTE_W_SPACE_DOT(res);
755+
}
750756
}
751757
}
752758

0 commit comments

Comments
 (0)