Bug 436333

Summary: Opening Discover with a .flatpakref file for an already-installed app causes an error
Product: [Applications] Discover Reporter: Felipe Kinoshita <kinofhek>
Component: Flatpak BackendAssignee: Dan Leinir Turthra Jensen <leinir>
Status: RESOLVED FIXED    
Severity: minor CC: aleixpol, jgrulich, nate
Priority: NOR    
Version: 5.21.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.22

Description Felipe Kinoshita 2021-04-29 01:57:57 UTC
When opening a .flatpakref file and Discover is not open causes an error.

STEPS TO REPRODUCE
1. grab a .flatpakref file (e.g com.spotify.Client.flatpakref from flathub)
2. with discover closed, double click the .flatpakref file

OBSERVED RESULT
Discover launches with an error: "Could not open file:///path/to/flatpakref.

EXPECTED RESULT
Discover should open .flatpakref files correctly.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed
(available in About System)
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
It does work if you double click the .flatpakref while Discover is open.
Comment 1 Aleix Pol 2021-04-30 01:37:50 UTC
I can reproduce it for applications I already have installed. Can you confirm that you have the same problem?
Comment 2 Felipe Kinoshita 2021-04-30 02:28:05 UTC
Yes, this only occurs with already installed flatpaks.
Comment 3 Aleix Pol 2021-05-05 02:26:53 UTC
Git commit d8d568b86f809a558dc5215a04e6781e797ba62e by Aleix Pol.
Committed on 05/05/2021 at 02:24.
Pushed by apol into branch 'master'.

flatpak: Use async API to search for already installed flatpakrefs

libflatpak will refuse to give us a ref if it's already installed, so we
want to rely on the installed db. At startup it might not be loaded yet,
so let's just call a function that will do the right thing at the right
time.

M  +5    -3    libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp

https://invent.kde.org/plasma/discover/commit/d8d568b86f809a558dc5215a04e6781e797ba62e