Get the etag of all subfolder for the root directory

The root directory etag is not updated when the files change.
That's why we need to check the etag of all its sub items
This commit is contained in:
Olivier Goffart 2013-08-05 20:09:37 +02:00
parent 5d24599546
commit a9f23a8331

View file

@ -558,7 +558,14 @@ RequestEtagJob::RequestEtagJob(const QString& dir, QObject* parent)
{
QNetworkRequest req;
req.setUrl( QUrl( ownCloudInfo::instance()->webdavUrl(ownCloudInfo::instance()->_connection) + dir ) );
req.setRawHeader("Depth", "0");
if (dir.isEmpty() || dir == "/") {
/* For the root directory, we need to query the etags of all the sub directories
* because, at the time I am writing this comment (Owncloud 5.0.9), the etag of the
* root directory is not updated when the sub directories changes */
req.setRawHeader("Depth", "1");
} else {
req.setRawHeader("Depth", "0");
}
QByteArray xml("<?xml version=\"1.0\" ?>\n"
"<d:propfind xmlns:d=\"DAV:\">\n"
" <d:prop>\n"
@ -594,7 +601,7 @@ void RequestEtagJob::slotFinished()
reader.namespaceUri() == QLatin1String("DAV:")) {
QString name = reader.name().toString();
if (name == QLatin1String("getetag")) {
etag = reader.readElementText();
etag += reader.readElementText();
}
}
}