ttrss: fix downloading icons, now uses more proper relative URL detection
This commit is contained in:
parent
ebdde9646a
commit
2e76ae5b13
2 changed files with 3 additions and 5 deletions
|
@ -471,7 +471,6 @@ QString Application::userDataAppFolder() const {
|
||||||
// In "app" folder, we would like to separate all user data into own subfolder,
|
// In "app" folder, we would like to separate all user data into own subfolder,
|
||||||
// therefore stick to "data" folder in this mode.
|
// therefore stick to "data" folder in this mode.
|
||||||
return QDir::toNativeSeparators(applicationDirPath() + QDir::separator() + QSL("data4"));
|
return QDir::toNativeSeparators(applicationDirPath() + QDir::separator() + QSL("data4"));
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Application::userDataFolder() {
|
QString Application::userDataFolder() {
|
||||||
|
|
|
@ -926,11 +926,10 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(TtRssNetworkFactory*
|
||||||
|
|
||||||
if (obtain_icons) {
|
if (obtain_icons) {
|
||||||
QString icon_path =
|
QString icon_path =
|
||||||
item[QSL("icon")].type() == QJsonValue::String ? item[QSL("icon")].toString() : QString();
|
item[QSL("icon")].type() == QJsonValue::Type::String ? item[QSL("icon")].toString() : QString();
|
||||||
|
|
||||||
if (!icon_path.isEmpty()) {
|
if (!icon_path.isEmpty()) {
|
||||||
// Chop the "api/" suffix out and append
|
QString full_icon_address = QUrl(base_address).resolved(icon_path).toString();
|
||||||
QString full_icon_address = base_address + QL1C('/') + icon_path;
|
|
||||||
QPixmap icon;
|
QPixmap icon;
|
||||||
QList<QPair<QByteArray, QByteArray>> headers;
|
QList<QPair<QByteArray, QByteArray>> headers;
|
||||||
|
|
||||||
|
@ -941,7 +940,7 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(TtRssNetworkFactory*
|
||||||
auto res =
|
auto res =
|
||||||
NetworkFactory::downloadIcon({{full_icon_address, true}}, DOWNLOAD_TIMEOUT, icon, headers, proxy);
|
NetworkFactory::downloadIcon({{full_icon_address, true}}, DOWNLOAD_TIMEOUT, icon, headers, proxy);
|
||||||
|
|
||||||
if (res == QNetworkReply::NoError) {
|
if (res == QNetworkReply::NetworkError::NoError) {
|
||||||
feed->setIcon(icon);
|
feed->setIcon(icon);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue