This patch fixes problem

https://trac.macports.org/ticket/54962
in upstream: https://bugzilla.gnome.org/show_bug.cgi?id=788401

The problem is that in a quartz build the gdk-pixbuf cannot identify
the content type just from data because the xdgmime system is not used.
This patch has to be applied together with:

patch-gio-quartz-makefilein-generated.diff

--- gio/gosxcontenttype.c.orig	2017-10-02 01:45:48.000000000 +0200
+++ gio/gosxcontenttype.c	2017-10-02 01:46:16.000000000 +0200
@@ -25,6 +25,11 @@
 
 #include <CoreServices/CoreServices.h>
 
+#define XDG_PREFIX _gio_xdg
+#include "xdgmime/xdgmime.h"
+
+/* We lock this mutex whenever we modify global state in this module.  */
+G_LOCK_DEFINE_STATIC (gio_xdgmime);
 
 /*< internal >
  * create_cfstring_from_cstr:
@@ -429,7 +434,18 @@
   if (data && (!filename || !uti ||
                CFStringCompare (uti, CFSTR ("public.data"), 0) == kCFCompareEqualTo))
     {
-      if (looks_like_text (data, data_size))
+      const char *sniffed_mimetype;
+      int sniffed_prio;
+      G_LOCK (gio_xdgmime);
+      sniffed_mimetype = xdg_mime_get_mime_type_for_data (data, data_size, &sniffed_prio);
+      G_UNLOCK (gio_xdgmime);
+      if (sniffed_mimetype != XDG_MIME_TYPE_UNKNOWN)
+        {
+          gchar *uti_str = g_content_type_from_mime_type (sniffed_mimetype);
+          uti = create_cfstring_from_cstr (uti_str);
+          g_free (uti_str);
+        }
+      if (!uti && looks_like_text (data, data_size))
         {
           if (g_str_has_prefix ((const gchar*)data, "#!/"))
             uti = CFStringCreateCopy (NULL, CFSTR ("public.script"));
