gtkxfer: add 'file://' scheme to purple_notify_uri() argument

Thu, 12 May 2016 08:16:01 +0200

author
Jakub Adam <jakub.adam@ktknet.cz>
date
Thu, 12 May 2016 08:16:01 +0200
changeset 37675
d9798c40b7ec
parent 37674
7d8a81ae83cd
child 37676
a30c853356eb

gtkxfer: add 'file://' scheme to purple_notify_uri() argument

The argument should be a URI, so make sure what we pass is one.
Not doing so causes trouble when the filename contains spaces or special
characters which may get escaped:

'/tmp/some file.txt' turns into '/tmp/some%20file.txt' which for example
xdg-open treats as a different and likely non-existent file.
'file:///tmp/some%20file.txt' is still a valid file URI though.

pidgin/gtkxfer.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkxfer.c	Fri May 20 09:52:56 2016 -0500
+++ b/pidgin/gtkxfer.c	Thu May 12 08:16:01 2016 +0200
@@ -508,7 +508,9 @@
 	}
 	else
 	{
-		purple_notify_uri(NULL, filename);
+		char *uri = g_strdup_printf("file://%s", filename);
+		purple_notify_uri(NULL, uri);
+		g_free(uri);
 		return;
 	}
 

mercurial