QDBusXmlParser: Accept root node names with a leading slash

Task-number: QTBUG-2597
Change-Id: I72866e8c02a8a5b1f030faf3e580241219626e54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
bb10
Ievgenii Meshcheriakov 2023-06-30 12:54:52 +02:00
parent 248d2103b5
commit d625b9bc47
1 changed files with 5 additions and 3 deletions

View File

@ -326,9 +326,11 @@ void QDBusXmlParser::readInterface()
void QDBusXmlParser::readNode(int nodeLevel)
{
const QString objName = m_xml.attributes().value("name"_L1).toString();
const QString fullName = m_object->path.endsWith(u'/')
? (m_object->path + objName)
: QString(m_object->path + u'/' + objName);
QString fullName = m_object->path;
if (!(fullName.endsWith(u'/') || (nodeLevel == 0 && objName.startsWith(u'/'))))
fullName.append(u'/');
fullName += objName;
if (!QDBusUtil::isValidObjectPath(fullName)) {
qDBusParserError("Invalid D-Bus object path '%s' found while parsing introspection",
qPrintable(fullName));