Bug 797175 - Opening a file from a gvfs mount point fails

When testing for a MS Windows path which has a ":", a gvfs path with the
format '/run/user/1000/gvfs/smb-share:server=192.168.1.11,share=public/
test-xml-file.gnucash' is recognised as a Windows path. To avoid this
expand the test to ":/" and also ":\"
This commit is contained in:
Robert Fewell
2019-04-19 15:51:29 +01:00
parent e3e11afcb5
commit 20e2b6b5de

6
libgnucash/engine/gnc-uri-utils.c Normal file → Executable file
View File

@@ -177,8 +177,10 @@ void gnc_uri_get_components (const gchar *uri,
if ( gnc_uri_is_file_scheme ( *scheme ) )
{
/* a true file uri on windows can start file:///N:/
so we come here with /N:/ */
if (g_str_has_prefix (splituri[1], "/") && g_strstr_len (splituri[1], -1, ":") != NULL)
so we come here with /N:/, it could also be /N:\
*/
if (g_str_has_prefix (splituri[1], "/") &&
((g_strstr_len (splituri[1], -1, ":/") != NULL) || (g_strstr_len (splituri[1], -1, ":\\") != NULL)))
{
gchar *ptr = splituri[1];
*path = gnc_resolve_file_path ( ptr + 1 );