Commit c5282e63 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

pk: Find appstream ids with and without .desktop postfix

Some applications lost it over time
parent 70ba0514
......@@ -437,9 +437,11 @@ ResultsStream * PackageKitBackend::findResourceByPackageName(const QUrl& url)
if (host.isEmpty())
Q_EMIT passiveMessage(i18n("Malformed appstream url '%1'", url.toDisplayString()));
else {
const auto deprecatedHost = deprecatedAppstreamIds.value(url.host()); //try this as fallback
const auto deprecatedHost = deprecatedAppstreamIds.value(host); //try this as fallback
for (auto it = m_packages.packages.constBegin(), itEnd = m_packages.packages.constEnd(); it != itEnd; ++it) {
if (it.key().compare(host, Qt::CaseInsensitive) == 0 || it.key().compare(deprecatedHost, Qt::CaseInsensitive) == 0) {
if (it.key().compare(host, Qt::CaseInsensitive) == 0
|| it.key().compare(deprecatedHost, Qt::CaseInsensitive) == 0
|| (host.endsWith(QLatin1String(".desktop")) && host.compare(it.key()+QLatin1String(".desktop"), Qt::CaseInsensitive) == 0)) {
pkg = it.value();
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment