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

flatpak: Properly fallback to loading an app's info from...

flatpak: Properly fallback to loading an app's info from flatpak_installed_ref_load_appdata() when appstream is confused

AppStream doesn't support having 2 apps with the same id like it happens
on flathub for the separate beta/stable/lts branches.
This way we won't be showing the wrong version number when updating one
of these apps.
parent 593ce4ec
Pipeline #229759 passed with stage
in 1 minute and 22 seconds
......@@ -454,7 +454,7 @@ FlatpakResource *FlatpakBackend::getAppForInstalledRef(FlatpakInstallation *inst
AppStream::Component cid;
if (source && source->m_pool) {
QList<AppStream::Component> comps = source->componentsByName(name);
if (comps.isEmpty()) {
if (!comps.isEmpty()) {
const QString bundleId = refToBundleId(FLATPAK_REF(ref));
comps = kFilter<QList<AppStream::Component>>(comps, [&bundleId](const AppStream::Component &comp) -> bool {
return comp.bundle(AppStream::Bundle::Kind::KindFlatpak).id() == bundleId;
......@@ -465,15 +465,7 @@ FlatpakResource *FlatpakBackend::getAppForInstalledRef(FlatpakInstallation *inst
g_autoptr(GBytes) metadata = flatpak_installed_ref_load_appdata(ref, 0, 0);
if (metadata) {
auto meta = metadataFromBytes(metadata, m_cancellable);
const auto componentsProvided = meta->components();
if (!componentsProvided.isEmpty() && name != componentsProvided.constFirst().id()) {
qDebug() << "mismatch between flatpak and appstream" << name << componentsProvided.constFirst().id();
comps = source->m_pool->componentsById(componentsProvided.constFirst().id());
}
if (comps.isEmpty()) {
comps = componentsProvided;
}
comps = meta->components();
}
}
......
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