notification: Keep converted URIs as such when we prepend a path

This commit is contained in:
Marco Trevisan (Treviño) 2022-04-22 02:15:18 +02:00
parent 997e2e374a
commit f9c1cf1b71
1 changed files with 11 additions and 0 deletions

View File

@ -536,14 +536,18 @@ try_prepend_path (const char *base_path,
{
gchar *path_filename;
gchar *path_ret;
gboolean was_uri;
if (!path || *path == '\0')
return NULL;
was_uri = TRUE;
path_ret = NULL;
path_filename = g_filename_from_uri (base_path, NULL, NULL);
if (path_filename == NULL) {
was_uri = FALSE;
if (base_path && base_path[0] == G_DIR_SEPARATOR) {
path_filename = g_strdup (base_path);
} else {
@ -571,6 +575,13 @@ try_prepend_path (const char *base_path,
g_debug ("Nothing found at %s", path_ret);
g_free (path_ret);
path_ret = NULL;
} else if (was_uri) {
gchar *uri = g_filename_to_uri (path_ret, NULL, NULL);
if (uri != NULL) {
g_free (path_ret);
path_ret = uri;
}
}
g_free (path_filename);