mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
Bug 561172 – gnome-open fails on local URIs with anchors
2009-03-03 Alexander Larsson <alexl@redhat.com> Bug 561172 – gnome-open fails on local URIs with anchors * gdesktopappinfo.c: Don't force uris to filenames if the uri has an anchor, because that would strip the anchor. * glocalvfs.c: Strip anchor from file:// uris when creating GFile, since g_filename_from_uri doesn't handle them. svn path=/trunk/; revision=7953
This commit is contained in:
parent
f891d4e04e
commit
896c3d1b2c
@ -1,3 +1,15 @@
|
|||||||
|
2009-03-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
|
Bug 561172 – gnome-open fails on local URIs with anchors
|
||||||
|
|
||||||
|
* gdesktopappinfo.c:
|
||||||
|
Don't force uris to filenames if the uri has an anchor, because
|
||||||
|
that would strip the anchor.
|
||||||
|
|
||||||
|
* glocalvfs.c:
|
||||||
|
Strip anchor from file:// uris when creating GFile, since
|
||||||
|
g_filename_from_uri doesn't handle them.
|
||||||
|
|
||||||
2009-03-03 Alexander Larsson <alexl@redhat.com>
|
2009-03-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
Bug 562613 – Missing const modifier in string parameters
|
Bug 562613 – Missing const modifier in string parameters
|
||||||
|
@ -567,6 +567,7 @@ expand_macro (char macro,
|
|||||||
char *expanded;
|
char *expanded;
|
||||||
gboolean force_file_uri;
|
gboolean force_file_uri;
|
||||||
char force_file_uri_macro;
|
char force_file_uri_macro;
|
||||||
|
char *uri;
|
||||||
|
|
||||||
g_return_if_fail (exec != NULL);
|
g_return_if_fail (exec != NULL);
|
||||||
|
|
||||||
@ -602,15 +603,18 @@ expand_macro (char macro,
|
|||||||
case 'n':
|
case 'n':
|
||||||
if (uris)
|
if (uris)
|
||||||
{
|
{
|
||||||
if (!force_file_uri)
|
uri = uris->data;
|
||||||
|
if (!force_file_uri ||
|
||||||
|
/* Pass URI if it contains an anchor */
|
||||||
|
strchr (uri, '#') != NULL)
|
||||||
{
|
{
|
||||||
expanded = expand_macro_single (macro, uris->data);
|
expanded = expand_macro_single (macro, uri);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
expanded = expand_macro_single (force_file_uri_macro, uris->data);
|
expanded = expand_macro_single (force_file_uri_macro, uri);
|
||||||
if (expanded == NULL)
|
if (expanded == NULL)
|
||||||
expanded = expand_macro_single (macro, uris->data);
|
expanded = expand_macro_single (macro, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expanded)
|
if (expanded)
|
||||||
@ -629,15 +633,19 @@ expand_macro (char macro,
|
|||||||
case 'N':
|
case 'N':
|
||||||
while (uris)
|
while (uris)
|
||||||
{
|
{
|
||||||
if (!force_file_uri)
|
uri = uris->data;
|
||||||
|
|
||||||
|
if (!force_file_uri ||
|
||||||
|
/* Pass URI if it contains an anchor */
|
||||||
|
strchr (uri, '#') != NULL)
|
||||||
{
|
{
|
||||||
expanded = expand_macro_single (macro, uris->data);
|
expanded = expand_macro_single (macro, uri);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
expanded = expand_macro_single (force_file_uri_macro, uris->data);
|
expanded = expand_macro_single (force_file_uri_macro, uri);
|
||||||
if (expanded == NULL)
|
if (expanded == NULL)
|
||||||
expanded = expand_macro_single (macro, uris->data);
|
expanded = expand_macro_single (macro, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expanded)
|
if (expanded)
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "gioalias.h"
|
#include "gioalias.h"
|
||||||
|
|
||||||
@ -90,9 +91,22 @@ g_local_vfs_get_file_for_uri (GVfs *vfs,
|
|||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
GFile *file;
|
GFile *file;
|
||||||
|
char *stripped_uri, *hash;
|
||||||
|
|
||||||
|
if (strchr (uri, '#') != NULL)
|
||||||
|
{
|
||||||
|
stripped_uri = g_strdup (uri);
|
||||||
|
hash = strchr (stripped_uri, '#');
|
||||||
|
*hash = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stripped_uri = (char *)uri;
|
||||||
|
|
||||||
|
path = g_filename_from_uri (stripped_uri, NULL, NULL);
|
||||||
|
|
||||||
path = g_filename_from_uri (uri, NULL, NULL);
|
if (stripped_uri != uri)
|
||||||
|
g_free (stripped_uri);
|
||||||
|
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
file = _g_local_file_new (path);
|
file = _g_local_file_new (path);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user