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(); return QByteArray();
} }
bool Capabilities::chunkingNg() const
{
return _capabilities["dav"].toMap()["chunking"].toByteArray() >= "1.0";
}
} }

View file

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

View file

@ -270,9 +270,10 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItemPtr &item) {
job->setDeleteExistingFolder(deleteExisting); job->setDeleteExistingFolder(deleteExisting);
return job; return job;
} else { } else {
static const bool isNg = !qgetenv("OWNCLOUD_CHUNK_NG").isEmpty(); // FIXME! use server version
PropagateUploadFileCommon *job = 0; 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); job = new PropagateUploadFileNG(this, item);
} else { } else {
job = new PropagateUploadFileV1(this, item); job = new PropagateUploadFileV1(this, item);