-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Coming from https://gitlab.gnome.org/GNOME/evolution/-/issues/3245
The xdp_portal_compose_email() does not convert provided attachment paths to their equivalents, which a sandboxed app could use and actually attach it. In fact it does not change the path at all. In case of Evolution, you use URI like:
mailto:?subject=&body=&attachment=/path/to/file
where the /path/to/file is in the host filesystem, not in the sandbox file system.
A simple reproducer follows. Note: it is executed on the host system (by nautilus), and it can start the corresponding app in the flatpak.
Change the /path/to/file to an actual file, which is available in the host system, but not in the sandbox.
/* gcc `pkg-config --cflags --libs gio-2.0 libportal` test.c -g -O2 -o test && ./test */
#include <gio/gio.h>
#include <libportal/portal.h>
static void
send_email_done (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
GError *local_error = NULL;
if (!xdp_portal_compose_email_finish (XDP_PORTAL (source_object), result, &local_error)) {
g_warning ("Failed to send mail: %s", local_error ? local_error->message : "unknown error");
g_clear_error (&local_error);
}
g_main_loop_quit (user_data);
}
int main(void)
{
const gchar *files[] = { "/path/to/file", NULL };
const char * const addresses[] = { NULL };
GMainLoop *main_loop;
XdpPortal *portal;
GError *local_error = NULL;
portal = xdp_portal_initable_new (&local_error);
if (!portal) {
g_warning ("Failed to create portal: %s", local_error ? local_error->message : "unknown error");
g_clear_error (&local_error);
return 1;
}
main_loop = g_main_loop_new (NULL, FALSE);
xdp_portal_compose_email (portal, NULL, addresses,
NULL, NULL, NULL, NULL, (const char * const *) files,
XDP_EMAIL_FLAG_NONE, NULL, send_email_done, main_loop);
g_main_loop_run (main_loop);
g_main_loop_unref (main_loop);
g_object_unref (portal);
return 0;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels