60 lines
1.7 KiB
Diff
60 lines
1.7 KiB
Diff
From 7ec351e3f48029602e916f11c66468b609befc95 Mon Sep 17 00:00:00 2001
|
|
From: Philip Withnall <pwithnall@endlessos.org>
|
|
Date: Wed, 1 Jun 2022 14:00:01 +0100
|
|
Subject: [PATCH] xdgmime: Fix broken file:// content type lookups for
|
|
webkitgtk
|
|
|
|
This re-applies a chunk from commit e63262d49d40a36060 which was
|
|
accidentally lost when upstreaming the commit to xdgmime (as
|
|
https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/10).
|
|
|
|
The upstreamed commit was then re-backported to GLib as a1bfe899abe,
|
|
without the missing chunk.
|
|
|
|
The missing chunk is potentially causing incorrect content type results
|
|
for `file://` URIs when used from webkitgtk.
|
|
|
|
Thanks to Stephen Jung and Michael Catanzaro for investigating.
|
|
|
|
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
|
|
Fixes: #2639
|
|
---
|
|
gio/xdgmime/xdgmimecache.c | 18 +++++++++---------
|
|
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c
|
|
index f80f122a14..234e4b4677 100644
|
|
--- a/gio/xdgmime/xdgmimecache.c
|
|
+++ b/gio/xdgmime/xdgmimecache.c
|
|
@@ -568,17 +568,17 @@ cache_glob_lookup_suffix (const char *file_name,
|
|
n_entries = GET_UINT32 (cache->buffer, list_offset);
|
|
offset = GET_UINT32 (cache->buffer, list_offset + 4);
|
|
|
|
- n = cache_glob_node_lookup_suffix (cache,
|
|
- n_entries, offset,
|
|
- file_name, len,
|
|
- ignore_case,
|
|
- mime_types,
|
|
- n_mime_types);
|
|
- if (n > 0)
|
|
- return n;
|
|
+ n += cache_glob_node_lookup_suffix (cache,
|
|
+ n_entries, offset,
|
|
+ file_name, len,
|
|
+ ignore_case,
|
|
+ mime_types + n,
|
|
+ n_mime_types - n);
|
|
+ if (n == n_mime_types)
|
|
+ break;
|
|
}
|
|
|
|
- return 0;
|
|
+ return n;
|
|
}
|
|
|
|
static int compare_mime_weight (const void *a, const void *b)
|
|
--
|
|
GitLab
|
|
|