[evolution-data-server/gnome-3-38] 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/gnome-3-38] I#299 - e_xml_is_element_name: Can fail to match a namespaced node
- Date: Thu, 11 Feb 2021 10:14:44 +0000 (UTC)
commit e53b2d433308e54689c55402983166edcc03dc6c
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]