Files
void-packages/srcpkgs/tracker-miners/patches/xmp-ignore-invalid-dcsource.patch
2024-03-25 14:21:15 -07:00

36 lines
1.4 KiB
Diff

From 27b8a83c94ea6b3d5efab78b71e050f32f2de927 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Sun, 24 Mar 2024 01:09:13 +0100
Subject: [PATCH 2/2] tracker-extract: Do not accept non-URI dc:source in XMP
Our ontology requires this property to be a rdfs:Resource, trying
to insert random strings as IRIs will not work, so ignore the dc:source
in that case.
---
src/libtracker-extract/tracker-xmp.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index a0eca15eb..13c21f3cb 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -489,7 +489,14 @@ iterate_simple (const gchar *uri,
} else if (!data->identifier && g_ascii_strcasecmp (name, "identifier") == 0) {
data->identifier = g_strdup (value);
} else if (!data->source && g_ascii_strcasecmp (name, "source") == 0) {
- data->source = g_strdup (value);
+ gchar *uri_scheme;
+
+ uri_scheme = g_uri_parse_scheme (value);
+ if (uri_scheme != NULL) {
+ /* Source seems to be a full URI */
+ data->source = g_strdup (value);
+ g_free (uri_scheme);
+ }
} else if (!data->language && g_ascii_strcasecmp (name, "language") == 0) {
data->language = g_strdup (value);
} else if (!data->relation && g_ascii_strcasecmp (name, "relation") == 0) {
--
GitLab