mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
0cce764e78
commit
57eac14d82
@ -483,14 +483,15 @@ void
|
|||||||
gnc_launch_assoc (const char *uri)
|
gnc_launch_assoc (const char *uri)
|
||||||
{
|
{
|
||||||
wchar_t *winuri = NULL;
|
wchar_t *winuri = NULL;
|
||||||
|
gchar *filename = NULL;
|
||||||
/* ShellExecuteW open doesn't decode http escapes if it's passed a
|
/* ShellExecuteW open doesn't decode http escapes if it's passed a
|
||||||
* file URI so we have to do it. */
|
* file URI so we have to do it. */
|
||||||
if (gnc_uri_is_file_uri (uri))
|
if (gnc_uri_is_file_uri (uri))
|
||||||
{
|
{
|
||||||
gchar *uri_ue = g_uri_unescape_string (uri, NULL);
|
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);
|
winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
|
||||||
g_free (filename);
|
|
||||||
g_free (uri_ue);
|
g_free (uri_ue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -505,10 +506,11 @@ gnc_launch_assoc (const char *uri)
|
|||||||
{
|
{
|
||||||
const gchar *message =
|
const gchar *message =
|
||||||
_("GnuCash could not find the associated file");
|
_("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 (wincmd);
|
||||||
g_free (winuri);
|
g_free (winuri);
|
||||||
|
g_free (filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,9 +535,23 @@ gnc_launch_assoc (const char *uri)
|
|||||||
|
|
||||||
g_assert(error != NULL);
|
g_assert(error != NULL);
|
||||||
{
|
{
|
||||||
|
gchar *error_uri = NULL;
|
||||||
const gchar *message =
|
const gchar *message =
|
||||||
_("GnuCash could not open the associated URI:");
|
_("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);
|
PERR ("%s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
|
@ -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
|
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;
|
gchar *path_head_label;
|
||||||
|
|
||||||
// test for current folder being present
|
// 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);
|
gtk_label_set_text (GTK_LABEL(path_head), path_head_label);
|
||||||
g_free (path_head_label);
|
g_free (path_head_label);
|
||||||
g_free (path_head_str);
|
g_free (path_head_str);
|
||||||
|
g_free (path_head_ue_str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user