Chunking-NG: Enable if the server supports it

This commit is contained in:
Olivier Goffart 2016-10-21 16:42:27 +02:00
parent 273590fdfc
commit e33b89c222
3 changed files with 10 additions and 2 deletions

View file

@ -107,4 +107,10 @@ QByteArray Capabilities::uploadChecksumType() const
return QByteArray();
}
bool Capabilities::chunkingNg() const
{
return _capabilities["dav"].toMap()["chunking"].toByteArray() >= "1.0";
}
}

View file

@ -39,6 +39,7 @@ public:
bool sharePublicLinkEnforceExpireDate() const;
int sharePublicLinkExpireDateDays() const;
bool shareResharing() const;
bool chunkingNg() const;
/// returns true if the capabilities report notifications
bool notificationsAvailable() const;

View file

@ -270,9 +270,10 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItemPtr &item) {
job->setDeleteExistingFolder(deleteExisting);
return job;
} else {
static const bool isNg = !qgetenv("OWNCLOUD_CHUNK_NG").isEmpty(); // FIXME! use server version
PropagateUploadFileCommon *job = 0;
if (isNg && item->_size > chunkSize()) {
static const auto chunkng = qgetenv("OWNCLOUD_CHUNKING_NG");
if (item->_size > chunkSize()
&& (account()->capabilities().chunkingNg() || chunkng == "1") && chunkng != "0") {
job = new PropagateUploadFileNG(this, item);
} else {
job = new PropagateUploadFileV1(this, item);