Bug 797183 - association head path with spaces displayed wrong

The Transaction Association path head was being displayed with '%20' as
the space as it was not being unescaped. Fixed by unescaping and also
noticed that the error message string were wrong also.
This commit is contained in:
Robert Fewell 2019-04-09 17:23:20 +01:00
parent 0cce764e78
commit 57eac14d82
2 changed files with 23 additions and 5 deletions

View File

@ -483,14 +483,15 @@ void
gnc_launch_assoc (const char *uri)
{
wchar_t *winuri = NULL;
gchar *filename = NULL;
/* ShellExecuteW open doesn't decode http escapes if it's passed a
* file URI so we have to do it. */
if (gnc_uri_is_file_uri (uri))
{
gchar *uri_ue = g_uri_unescape_string (uri, NULL);
gchar *filename = gnc_uri_get_path (uri_ue);
filename = gnc_uri_get_path (uri_ue);
filename = g_strdelimit (filename, "/", '\\'); // needed for unc paths
winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
g_free (filename);
g_free (uri_ue);
}
else
@ -505,10 +506,11 @@ gnc_launch_assoc (const char *uri)
{
const gchar *message =
_("GnuCash could not find the associated file");
gnc_error_dialog(NULL, "%s: %s", message, uri);
gnc_error_dialog(NULL, "%s:\n%s", message, filename);
}
g_free (wincmd);
g_free (winuri);
g_free (filename);
}
}
@ -533,9 +535,23 @@ gnc_launch_assoc (const char *uri)
g_assert(error != NULL);
{
gchar *error_uri = NULL;
const gchar *message =
_("GnuCash could not open the associated URI:");
gnc_error_dialog(NULL, "%s\n%s", message, uri);
if (gnc_uri_is_file_uri (uri))
{
gchar *uri_ue = g_uri_unescape_string (uri, NULL);
gchar *filename = gnc_uri_get_path (uri_ue);
error_uri = g_strdup (filename);
g_free (uri_ue);
g_free (filename);
}
else
error_uri = g_strdup (uri);
gnc_error_dialog(NULL, "%s\n%s", message, error_uri);
g_free (error_uri);
}
PERR ("%s", error->message);
g_error_free(error);

View File

@ -486,7 +486,8 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
if (assoc_dialog->path_head && g_strcmp0 (assoc_dialog->path_head, "") != 0) // not default entry
{
gchar *path_head_str = gnc_uri_get_path (assoc_dialog->path_head);
gchar *path_head_ue_str = g_uri_unescape_string (assoc_dialog->path_head, NULL);
gchar *path_head_str = gnc_uri_get_path (path_head_ue_str);
gchar *path_head_label;
// test for current folder being present
@ -499,6 +500,7 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
gtk_label_set_text (GTK_LABEL(path_head), path_head_label);
g_free (path_head_label);
g_free (path_head_str);
g_free (path_head_ue_str);
}
else
{