diff options
author | Matthew Leeds <mwleeds@protonmail.com> | 2018-01-14 22:26:03 -0800 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2018-01-30 11:34:07 +0100 |
commit | 606e69e22c00457e388bb4de4793ac27bceda74f (patch) | |
tree | eca55c61a6e36d5e9c526fd3de2c84fde493a0e4 | |
parent | 85cda5d2037521d5163c6a2e2bca75b564a4fc12 (diff) | |
download | flatpak-606e69e22c00457e388bb4de4793ac27bceda74f.tar.gz |
remote-info: Fix --show-metadata behavior
When the --show-metadata option is used with remote-info, the metadata
variable is never initialized, causing flatpak to print "(null)". This
commit makes sure the variable is properly initialized so the metadata
prints correctly.
Closes: #1313
Approved by: alexlarsson
(cherry picked from commit bf07d6b596b0229f62e3685e72c808543074e91d)
-rw-r--r-- | app/flatpak-builtins-info-remote.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/flatpak-builtins-info-remote.c b/app/flatpak-builtins-info-remote.c index 2c69d5e7..adc44c51 100644 --- a/app/flatpak-builtins-info-remote.c +++ b/app/flatpak-builtins-info-remote.c @@ -275,7 +275,14 @@ flatpak_builtin_info_remote (int argc, char **argv, GCancellable *cancellable, G g_print ("\n"); if (opt_show_metadata) - g_print ("%s", xa_metadata); + { + g_autoptr(GVariant) c_m = NULL; + c_m = g_variant_get_child_value (c_v, 0); + g_variant_lookup (c_m, "xa.metadata", "&s", &xa_metadata); + if (xa_metadata == NULL) + return flatpak_fail (error, "Commit %s has no metadata", c); + g_print ("%s", xa_metadata); + } g_free (c); c = g_steal_pointer (&p); |