Bug 799490 - Error on start or opening a gnucash file: Can't parse the URL

g_filename_from_uri can't handle # in paths but gnc_uri_get_path can.
pull/2090/head
John Ralls 1 year ago
parent 910130c500
commit 019fbb3f58

@ -144,8 +144,7 @@ gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unus
}
if (g_str_has_prefix (url, "file://"))
{
if ( g_file_test( g_filename_from_uri( url, NULL, NULL ),
G_FILE_TEST_IS_DIR ))
if ( g_file_test (gnc_uri_get_path (url), G_FILE_TEST_IS_DIR))
{
gtk_file_chooser_set_current_folder_uri( faw->fileChooser, url );
return;

@ -75,6 +75,7 @@
#include "gnc-prefs.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include <gnc-uri-utils.h>
#include <gnc-session.h>
#include "gnc-component-manager.h"
#include "dialog-preferences.h"
@ -887,7 +888,7 @@ gnc_prefs_connect_file_chooser_button (GtkFileChooserButton *fcb, const gchar *b
if (uri && *uri) // default entry
{
gchar *path_head = g_filename_from_uri (uri, NULL, NULL);
gchar *path_head = gnc_uri_get_path (uri);
// test for current folder present and set chooser to it
if (g_file_test (path_head, G_FILE_TEST_IS_DIR))

@ -55,6 +55,7 @@ static QofLogModule log_module = QOF_MOD_SESSION;
#include "qof-backend.hpp"
#include "qofsession.hpp"
#include "gnc-backend-prov.hpp"
#include "gnc-uri-utils.h"
#include <vector>
#include <boost/algorithm/string.hpp>
@ -274,7 +275,7 @@ QofSessionImpl::begin (const char* new_uri, SessionOpenMode mode) noexcept
char * scheme {g_uri_parse_scheme (new_uri)};
char * filename {nullptr};
if (g_strcmp0 (scheme, "file") == 0)
filename = g_filename_from_uri (new_uri, nullptr, nullptr);
filename = gnc_uri_get_path(new_uri);
else if (!scheme)
filename = g_strdup (new_uri);

Loading…
Cancel
Save