GApplication::open / g_application_open doesn't handle mailto URIs
Since GApplication's open signal and g_application_open
requires GFile instances to be passed in, it is not possible to use this for non-hierarchical URI schemes such as mailto
, because GFile will mangle the URIs. This is the GApplication side of the bug reported in https://bugzilla.gnome.org/show_bug.cgi?id=779182 and fixed in 796599a7
To reproduce, select a DBus activatable application G_APPLICATION_HANDLES_OPEN
as the default handler for mailto
URIs (such as Geary from geary!297 (merged)) and call gio open mailto:test@example.com
. When obtaining the mailto URI from the GFile passed to GApplication::open
by calling g_file_get_uri
, the result will be mailto:///test@example.com
, rather than the expected mailto:test@example.com
.
This may or may not be a problem for HTTP URLs passed to open
, but since Ephy isn't currently DBus activatable I can't test it easily.
I'm currently being bitten by this after porting Geary to be D-Bus activatable, because due to #1853 I am forced to implement G_APPLICATION_HANDLES_OPEN
if Geary will be invoked at all by a call to gio open
, rather than having the open argument passed to the primary instance's command line handling machinery as suggested by the app's use of G_APPLICATION_HANDLES_COMMAND_LINE
. So, after implementing support for open, when opening a mailto
URI the email address is now prefixed with '///'.
One possible fix would be to add a GApplication::open-uri
signal and g_application_open_uri
to pass bare URIs as strings for non-file URIs. Another possible fix would be make GFile gracefully handle non-hierarchical URIs, but that seems like a bit of a kludge.