gnucash maint: Bug 797175 - Gnucash will not open from UNC paths.

Robert Fewell bobit at code.gnucash.org
Fri Apr 12 06:59:08 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/0f6465ca (commit)
	from  https://github.com/Gnucash/gnucash/commit/c091197f (commit)



commit 0f6465ca6ddfb882db15c54685ba218e5c59c430
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri Apr 12 11:46:59 2019 +0100

    Bug 797175 - Gnucash will not open from UNC paths.
    
    UNC paths were overlooked in a change I made, corrected and added some
    notes to source file for reminder.

diff --git a/libgnucash/engine/gnc-uri-utils.c b/libgnucash/engine/gnc-uri-utils.c
index 56390041c..0158820e3 100644
--- a/libgnucash/engine/gnc-uri-utils.c
+++ b/libgnucash/engine/gnc-uri-utils.c
@@ -323,7 +323,22 @@ gchar *gnc_uri_create_uri (const gchar *scheme,
         else
             uri_scheme = g_strdup (scheme);
 
-        if (g_str_has_prefix (abs_path, "/"))
+        /* Arrive here with...
+         *
+         * /my/path/to/file with space.txt
+         * becomes file:///my/path/to/file with space.txt
+         *
+         * c:\my\path\to\file with space.txt
+         * becomes file:///c:\my\path\to\file with space.txt
+         *
+         * \\myserver\share\path\to\file with space.txt
+         * becomes file://\\myserver\share\path\to\file with space.txt
+         *
+         * probably they should all be forward slashs and spaces escaped
+         * also with UNC it could be file://myserver/share/path/to/file with space.txt
+         */
+
+        if (g_str_has_prefix (abs_path, "/") || g_str_has_prefix (abs_path, "\\"))
             uri = g_strdup_printf ( "%s://%s", uri_scheme, abs_path );
         else // for windows add an extra "/"
             uri = g_strdup_printf ( "%s:///%s", uri_scheme, abs_path );



Summary of changes:
 libgnucash/engine/gnc-uri-utils.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list