[gnome-software/1886-mutually-exclusive-states-in-flatpakref-conflict-and-produce-similar-errors] flatpak: Some keys in .flatpakref file are optional
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1886-mutually-exclusive-states-in-flatpakref-conflict-and-produce-similar-errors] flatpak: Some keys in .flatpakref file are optional
- Date: Thu, 1 Sep 2022 06:22:10 +0000 (UTC)
commit 934559be505870ff1d385c778d8ad433007aacc7
Author: Milan Crha <mcrha redhat com>
Date: Thu Sep 1 08:20:13 2022 +0200
flatpak: Some keys in .flatpakref file are optional
The flatpak documentation claims some keys in the .flatpakref file
as options, with defined default value, but the plugin treated them
as mandatory, which could cause the app/runtime not being shown in
the GUI.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1886
plugins/flatpak/gs-flatpak.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index b14e05501..453ed4222 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -3925,15 +3925,23 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
gs_utils_error_convert_gio (error);
return NULL;
}
- ref_branch = g_key_file_get_string (kf, "Flatpak Ref", "Branch", error);
- if (ref_branch == NULL) {
- gs_utils_error_convert_gio (error);
- return NULL;
+ if (g_key_file_has_key (kf, "Flatpak Ref", "Branch", NULL)) {
+ ref_branch = g_key_file_get_string (kf, "Flatpak Ref", "Branch", error);
+ if (ref_branch == NULL) {
+ gs_utils_error_convert_gio (error);
+ return NULL;
+ }
+ } else {
+ ref_branch = g_strdup ("master");
}
- is_runtime = g_key_file_get_boolean (kf, "Flatpak Ref", "IsRuntime", error);
- if (error != NULL && *error != NULL) {
- gs_utils_error_convert_gio (error);
- return NULL;
+ if (g_key_file_has_key (kf, "Flatpak Ref", "IsRuntime", NULL)) {
+ is_runtime = g_key_file_get_boolean (kf, "Flatpak Ref", "IsRuntime", error);
+ if (error != NULL && *error != NULL) {
+ gs_utils_error_convert_gio (error);
+ return NULL;
+ }
+ } else {
+ is_runtime = FALSE;
}
if (unrefined) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]