[Libosinfo] [PATCH] osinfo-db-import: fix loading of local files

Daniel P. Berrangé berrange at redhat.com
Thu Dec 20 09:22:34 UTC 2018


When the argument can be either a URI or a local path, it the
g_file_new_for_commandline_arg constructor must be used. In
addition, when the GFile is a native path, we must not use the original
path, but instead call g_file_get_path(), so that file:/// URIs are
correctly handled by stripping the protocol.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---

Pushed as a build fix

 tools/osinfo-db-import.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/osinfo-db-import.c b/tools/osinfo-db-import.c
index 91a7125..920f71b 100644
--- a/tools/osinfo-db-import.c
+++ b/tools/osinfo-db-import.c
@@ -318,7 +318,7 @@ static int osinfo_db_import_extract(GFile *target,
         source = NULL;
 
     if (source != NULL) {
-        file = g_file_new_for_uri(source);
+        file = g_file_new_for_commandline_arg(source);
         if (file == NULL)
             goto cleanup;
 
@@ -327,7 +327,7 @@ static int osinfo_db_import_extract(GFile *target,
             if (osinfo_db_import_download_file(file, &source_file) < 0)
                 goto cleanup;
         } else {
-            source_file = g_strdup(source);
+            source_file = g_file_get_path(file);
         }
         if (source_file == NULL)
             goto cleanup;
-- 
2.19.2




More information about the Libosinfo mailing list