diff options
author | Markus Goetz <markus@woboq.com> | 2019-08-01 13:01:39 +0300 |
---|---|---|
committer | Markus Goetz <markus@woboq.com> | 2019-08-01 13:01:39 +0300 |
commit | 08fe3aee955d1db98df5a33e5ffbc538e0e558dd (patch) | |
tree | 092b06854d7d184f2ca52b407118a7c84b62dc3c | |
parent | 3d0d15481d37cfa68944a09e1b2b6593289d3889 (diff) |
-rw-r--r-- | src/libsync/networkjobs.cpp | 16 | ||||
-rw-r--r-- | src/libsync/networkjobs.h | 3 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index e4d3a20df..ee582f337 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -221,14 +221,18 @@ bool LsColXMLParser::parseSome(const QByteArray &xml) qDebug() << "INSIDE PROP "; insideProp = true; continue; - } else if (name == QLatin1String("resourcetype") && reader.namespaceUri() == QLatin1String("DAV:") && insideProp) { - insideResourcetype = true; // resourcetype is the only nested property we care about - continue; + } else if (insideProp && reader.namespaceUri() == QLatin1String("DAV:") && currentPropName.isEmpty()) { + // There might be nested properties like hen having <oc:share-types><oc:share-type>0</oc:share-type></oc:share-types> + currentPropName = currentName; + if (name == QLatin1String("resourcetype")) { + insideResourcetype = true; // resourcetype + continue; + } } else if (name == QLatin1String("collection") && reader.namespaceUri() == QLatin1String("DAV:") && insidePropstat && insideProp && insideResourcetype) { qDebug() << "ISCOLLECTION"<<currentHref; currentTmpProperties.insert(QLatin1String("resourcetype"), QLatin1String("collection")); folders.append(currentHref); - } else if (name == QLatin1String("status") && reader.namespaceUri() == QLatin1String("DAV:") && insidePropstat) { + } else if (name == QLatin1String("status") && reader.namespaceUri() == QLatin1String("DAV:") && insidePropstat && !insideProp) { insideStatus = true; continue; } else { @@ -257,7 +261,7 @@ bool LsColXMLParser::parseSome(const QByteArray &xml) } } // FIXME reader.name is empty now when between.. - currentTmpProperties.insert(name, propertyContent); + currentTmpProperties.insert(currentPropName, propertyContent); } else if (type == QXmlStreamReader::Characters && insideHref) { // We don't use URL encoding in our request URL (which is the expected path) (QNAM will do it for us) // but the result will have URL encoding.. @@ -290,6 +294,8 @@ bool LsColXMLParser::parseSome(const QByteArray &xml) insideStatus = false; } else if (reader.name() == "prop" && insideProp) { insideProp = false; + } else if (reader.name() == currentPropName && insideProp) { + currentPropName.clear(); // This is not 100% correct if there would be a nested property like <prop><a><a>bla</a></a></prop> } else if (reader.name() == "resourcetype" && insideResourcetype) { insideResourcetype = false; } diff --git a/src/libsync/networkjobs.h b/src/libsync/networkjobs.h index c6a598990..dea5bc00c 100644 --- a/src/libsync/networkjobs.h +++ b/src/libsync/networkjobs.h @@ -81,7 +81,8 @@ protected: QString _expectedPath; QXmlStreamReader reader; QStringList folders; - QString currentName; + QString currentName; // any element name + QString currentPropName; // element name of a direct child in <prop> QString currentHref; QMap<QString, QString> currentTmpProperties; QMap<QString, QString> currentHttp200Properties; |