[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [libosinfo] Don't entertain empty ID headers from ISOs



From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>

---
 osinfo/osinfo_media.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index cf065f0..8c51a0d 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -517,6 +517,20 @@ OsinfoMedia *osinfo_media_create_from_location(const gchar *location,
     return ret;
 }
 
+static gboolean is_str_empty(const gchar *str) {
+    guint8 i;
+    gboolean ret = TRUE;
+
+    for (i = 0; i < strlen (str); i++)
+        if (!g_ascii_isspace (str[i])) {
+           ret = FALSE;
+
+           break;
+        }
+
+    return ret;
+}
+
 static void on_svd_read (GObject *source,
                          GAsyncResult *res,
                          gpointer user_data)
@@ -564,15 +578,15 @@ static void on_svd_read (GObject *source,
                             OSINFO_MEDIA_PROP_URL,
                             uri);
     g_free(uri);
-    if (data->pvd.volume[0] != 0)
+    if (data->pvd.volume[0] != 0 && !is_str_empty (data->pvd.volume))
         osinfo_entity_set_param(OSINFO_ENTITY(ret),
                                 OSINFO_MEDIA_PROP_VOLUME_ID,
                                 data->pvd.volume);
-    if (data->pvd.system[0] != 0)
+    if (data->pvd.system[0] != 0 && !is_str_empty (data->pvd.system))
         osinfo_entity_set_param(OSINFO_ENTITY(ret),
                                 OSINFO_MEDIA_PROP_SYSTEM_ID,
                                 data->pvd.system);
-    if (data->pvd.publisher[0] != 0)
+    if (data->pvd.publisher[0] != 0 && !is_str_empty (data->pvd.publisher))
         osinfo_entity_set_param(OSINFO_ENTITY(ret),
                                 OSINFO_MEDIA_PROP_PUBLISHER_ID,
                                 data->pvd.publisher);
-- 
1.7.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]