Add patch to fix incorrect MIME type for file transfer portal
authorSimon McVittie <smcv@debian.org>
Wed, 8 Mar 2023 14:52:02 +0000 (14:52 +0000)
committerSimon McVittie <smcv@debian.org>
Wed, 8 Mar 2023 14:52:02 +0000 (14:52 +0000)
Regression in 3.24.37, affecting interoperability with other
implementations like the one requested in QTBUG-91357.

debian/patches/selection-Use-the-right-mime-type.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/selection-Use-the-right-mime-type.patch b/debian/patches/selection-Use-the-right-mime-type.patch
new file mode 100644 (file)
index 0000000..1c6e870
--- /dev/null
@@ -0,0 +1,82 @@
+From: Matthias Clasen <mclasen@redhat.com>
+Date: Mon, 6 Mar 2023 23:06:15 -0500
+Subject: selection: Use the right mime type
+
+The correct mime type for portal file transfers
+is application/vnd.portal.filetransfer.
+
+Origin: upstream, 3.24.38, commit:5fee632386f773ff7f0af611bcdfdeeee46dab15
+Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/5643
+---
+ gtk/gtkselection.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
+index 048b4ad..82755e9 100644
+--- a/gtk/gtkselection.c
++++ b/gtk/gtkselection.c
+@@ -343,6 +343,7 @@ static GdkAtom text_plain_utf8_atom;
+ static GdkAtom text_plain_locale_atom;
+ static GdkAtom text_uri_list_atom;
+ static GdkAtom portal_files_atom;
++static GdkAtom portal_filetransfer_atom;
+ static void 
+ init_atoms (void)
+@@ -364,6 +365,7 @@ init_atoms (void)
+       text_uri_list_atom = gdk_atom_intern_static_string ("text/uri-list");
+       portal_files_atom = gdk_atom_intern_static_string ("application/vnd.portal.files");
++      portal_filetransfer_atom = gdk_atom_intern_static_string ("application/vnd.portal.filetransfer");
+     }
+ }
+@@ -526,7 +528,10 @@ gtk_target_list_add_uri_targets (GtkTargetList *list,
+ #ifndef G_OS_WIN32
+   if (file_transfer_portal_supported ())
+-    gtk_target_list_add (list, portal_files_atom, 0, info);
++    {
++      gtk_target_list_add (list, portal_filetransfer_atom, 0, info);
++      gtk_target_list_add (list, portal_files_atom, 0, info);
++    }
+ #endif
+ }
+@@ -1899,7 +1904,8 @@ gtk_selection_data_set_uris (GtkSelectionData  *selection_data,
+       }
+     }
+ #ifndef G_OS_WIN32
+-  else if (selection_data->target == portal_files_atom &&
++  else if ((selection_data->target == portal_filetransfer_atom ||
++            selection_data->target == portal_files_atom) &&
+            file_transfer_portal_supported ())
+     {
+       GPtrArray *a;
+@@ -1940,7 +1946,7 @@ gtk_selection_data_set_uris (GtkSelectionData  *selection_data,
+         }
+       gtk_selection_data_set (selection_data,
+-                              portal_files_atom,
++                              selection_data->target,
+                               8, (guchar *)key, strlen (key));
+       g_strfreev (files);
+@@ -1996,7 +2002,8 @@ gtk_selection_data_get_uris (const GtkSelectionData *selection_data)
+     }
+ #ifndef G_OS_WIN32
+   else if (selection_data->length >= 0 &&
+-           selection_data->type == portal_files_atom &&
++           (selection_data->type == portal_filetransfer_atom ||
++            selection_data->type == portal_files_atom) &&
+            file_transfer_portal_supported ())
+     {
+       char *key;
+@@ -2353,6 +2360,7 @@ gtk_targets_include_uri (GdkAtom *targets,
+   for (i = 0; i < n_targets; i++)
+     {
+       if (targets[i] == text_uri_list_atom ||
++          targets[i] == portal_filetransfer_atom ||
+           targets[i] == portal_files_atom)
+       {
+         result = TRUE;
index 75e2a23964183fb1c26599bf5605e46a789b9b85..97012797a831d8bf54c424c9d04571c2a96475a2 100644 (file)
@@ -1,3 +1,4 @@
+selection-Use-the-right-mime-type.patch
 016_no_offscreen_widgets_grabbing.patch
 017_no_offscreen_device_grabbing.patch
 060_ignore-random-icons.patch