[libgxps] Revert "parse-utils: avoid mixing files with paths"



commit 6dd9b795bb2807d9b2024ac97f72407c545b5510
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Jan 29 09:38:56 2017 +0100

    Revert "parse-utils: avoid mixing files with paths"
    
    This reverts commit 8f04b292c0e551e2ba8dba2c77012699e40685c7. It broke
    structure paths containig '..'.

 libgxps/gxps-parse-utils.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/libgxps/gxps-parse-utils.c b/libgxps/gxps-parse-utils.c
index 6cb6679..18dff53 100644
--- a/libgxps/gxps-parse-utils.c
+++ b/libgxps/gxps-parse-utils.c
@@ -399,6 +399,8 @@ gchar *
 gxps_resolve_relative_path (const gchar *source,
                            const gchar *target)
 {
+       GFile *source_file;
+       GFile *abs_file;
        gchar *dirname;
        gchar *retval;
 
@@ -408,10 +410,13 @@ gxps_resolve_relative_path (const gchar *source,
        dirname = g_path_get_dirname (source);
        if (strlen (dirname) == 1 && dirname[0] == '.')
                dirname[0] = '/';
-
-       /* We want / on all platforms */
-       retval = g_build_path ("/", dirname, target, NULL);
+       source_file = g_file_new_for_path (dirname);
        g_free (dirname);
 
+       abs_file = g_file_resolve_relative_path (source_file, target);
+       retval = g_file_get_path (abs_file);
+       g_object_unref (abs_file);
+       g_object_unref (source_file);
+
        return retval;
 }


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