[gnome-software/1111-version-history-box: 1/4] flatpak: Properly detect offline case
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1111-version-history-box: 1/4] flatpak: Properly detect offline case
- Date: Tue, 9 Feb 2021 04:12:48 +0000 (UTC)
commit 53d6b30eed62bd31f67b5e4229514e0c0248523b
Author: Phaedrus Leeds <mwleeds endlessos org>
Date: Mon Feb 8 17:58:32 2021 -0800
flatpak: Properly detect offline case
We want to still refine what information we can if we fail to get size
information due to being offline. There was already a check to that
effect but the code path wasn't being hit because the
GS_PLUGIN_ERROR_NO_NETWORK error code wasn't being set.
plugins/flatpak/gs-flatpak.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index c528fb5d0..971899763 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2123,6 +2123,7 @@ gs_flatpak_fetch_remote_metadata (GsFlatpak *self,
{
g_autoptr(GBytes) data = NULL;
g_autoptr(FlatpakRef) xref = NULL;
+ g_autoptr(GError) local_error = NULL;
/* no origin */
if (gs_app_get_origin (app) == NULL) {
@@ -2142,9 +2143,16 @@ gs_flatpak_fetch_remote_metadata (GsFlatpak *self,
gs_app_get_origin (app),
xref,
cancellable,
- error);
+ &local_error);
if (data == NULL) {
- gs_flatpak_error_convert (error);
+ if (g_error_matches (local_error, FLATPAK_ERROR, FLATPAK_ERROR_REF_NOT_FOUND) &&
+ !gs_plugin_get_network_available (self->plugin)) {
+ local_error->code = GS_PLUGIN_ERROR_NO_NETWORK;
+ local_error->domain = GS_PLUGIN_ERROR;
+ } else {
+ gs_flatpak_error_convert (&local_error);
+ }
+ g_propagate_error (error, g_steal_pointer (&local_error));
return NULL;
}
return g_steal_pointer (&data);
@@ -2694,8 +2702,7 @@ gs_flatpak_refine_app_unlocked (GsFlatpak *self,
g_autoptr(GError) error_local = NULL;
if (!gs_plugin_refine_item_size (self, app,
cancellable, &error_local)) {
- if (!gs_plugin_get_network_available (self->plugin) &&
- g_error_matches (error_local, GS_PLUGIN_ERROR,
+ if (g_error_matches (error_local, GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_NO_NETWORK)) {
g_debug ("failed to get size while "
"refining app %s: %s",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]