Server: Fix endless loop when processing WFS Transaction document with non-mappable attribute names

This commit is contained in:
Sandro Mani 2025-06-11 21:15:01 +02:00
parent cd2944e57f
commit 9f751f232f
2 changed files with 4 additions and 4 deletions

View File

@ -803,7 +803,7 @@ namespace QgsWfs
QDomNode currentAttributeChild = featureElem.firstChild();
bool conversionSuccess = true;
while ( !currentAttributeChild.isNull() )
for (; !currentAttributeChild.isNull(); currentAttributeChild = currentAttributeChild.nextSibling() )
{
QDomElement currentAttributeElement = currentAttributeChild.toElement();
QString attrName = currentAttributeElement.localName();
@ -815,6 +815,7 @@ namespace QgsWfs
fieldMapIt = fieldMap.find( attrName );
if ( fieldMapIt == fieldMap.constEnd() )
{
QgsMessageLog::logMessage( QStringLiteral( "Skipping unknown attribute: name=%1" ).arg( attrName ) );
continue;
}
@ -847,7 +848,6 @@ namespace QgsWfs
feat.setGeometry( g );
}
}
currentAttributeChild = currentAttributeChild.nextSibling();
}
// update feature list
featList << feat;

View File

@ -780,7 +780,7 @@ namespace QgsWfs
QDomNode currentAttributeChild = featureElem.firstChild();
bool conversionSuccess = true;
while ( !currentAttributeChild.isNull() )
for (; !currentAttributeChild.isNull(); currentAttributeChild = currentAttributeChild.nextSibling() )
{
QDomElement currentAttributeElement = currentAttributeChild.toElement();
QString attrName = currentAttributeElement.localName();
@ -792,6 +792,7 @@ namespace QgsWfs
fieldMapIt = fieldMap.find( attrName );
if ( fieldMapIt == fieldMap.constEnd() )
{
QgsMessageLog::logMessage( QStringLiteral( "Skipping unknown attribute: name=%1" ).arg( attrName ) );
continue;
}
@ -824,7 +825,6 @@ namespace QgsWfs
feat.setGeometry( g );
}
}
currentAttributeChild = currentAttributeChild.nextSibling();
}
// update feature list
featList << feat;