[evolution-data-server] I#299 - e_xml_is_element_name: Can fail to match a namespaced node
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] I#299 - e_xml_is_element_name: Can fail to match a namespaced node
- Date: Thu, 11 Feb 2021 10:13:17 +0000 (UTC)
commit dfcf247ba26fafd1a3ede323244480ad7251b03d
Author: Milan Crha <mcrha redhat com>
Date: Thu Feb 11 11:10:27 2021 +0100
I#299 - e_xml_is_element_name: Can fail to match a namespaced node
When the XML document defines two namespace prefixes for the same
namespace HREF, the xmlSearchNsByHref() might not necessarily return
the same namespace structure as the one being set on the 'node',
which could lead to a failure to match the namespace, even
the namespace HREF matched.
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/299
src/libedataserver/e-xml-utils.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/libedataserver/e-xml-utils.c b/src/libedataserver/e-xml-utils.c
index 10bfcef99..a80fb1b48 100644
--- a/src/libedataserver/e-xml-utils.c
+++ b/src/libedataserver/e-xml-utils.c
@@ -494,7 +494,12 @@ e_xml_is_element_name (xmlNode *node,
if (!node->ns)
return TRUE;
} else if (node->ns) {
- xmlNsPtr nsPtr = xmlSearchNsByHref (node->doc, node, (const xmlChar *) ns_href);
+ xmlNsPtr nsPtr;
+
+ if (g_strcmp0 ((const gchar *) node->ns->href, ns_href) == 0)
+ return TRUE;
+
+ nsPtr = xmlSearchNsByHref (node->doc, node, (const xmlChar *) ns_href);
if (nsPtr && node->ns == nsPtr)
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]