mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Merge pull request #2821 from nextcloud/e2ee-fix-parallel-uploads-issue
E2EE fix upload parallelism issue.
This commit is contained in:
commit
4a1c650a56
4 changed files with 28 additions and 41 deletions
|
@ -301,6 +301,29 @@ void PropagateItemJob::slotRestoreJobFinished(SyncFileItem::Status status)
|
|||
}
|
||||
}
|
||||
|
||||
bool PropagateItemJob::hasEncryptedAncestor() const
|
||||
{
|
||||
if (!propagator()->account()->capabilities().clientSideEncryptionAvailable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto path = _item->_file;
|
||||
const auto slashPosition = path.lastIndexOf('/');
|
||||
const auto parentPath = slashPosition >= 0 ? path.left(slashPosition) : QString();
|
||||
|
||||
auto pathComponents = parentPath.split('/');
|
||||
while (!pathComponents.isEmpty()) {
|
||||
SyncJournalFileRecord rec;
|
||||
propagator()->_journal->getFileRecord(pathComponents.join('/'), &rec);
|
||||
if (rec.isValid() && rec._isE2eEncrypted) {
|
||||
return true;
|
||||
}
|
||||
pathComponents.removeLast();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
|
||||
PropagateItemJob *OwncloudPropagator::createJob(const SyncFileItemPtr &item)
|
||||
|
|
|
@ -171,6 +171,8 @@ protected:
|
|||
_item->_errorString = msg;
|
||||
}
|
||||
|
||||
bool hasEncryptedAncestor() const;
|
||||
|
||||
protected slots:
|
||||
void slotRestoreJobFinished(SyncFileItem::Status status);
|
||||
|
||||
|
|
|
@ -34,14 +34,6 @@ PropagateRemoteMkdir::PropagateRemoteMkdir(OwncloudPropagator *propagator, const
|
|||
, _uploadEncryptedHelper(nullptr)
|
||||
, _parallelism(FullParallelism)
|
||||
{
|
||||
const auto rootPath = [=]() {
|
||||
const auto result = propagator->remotePath();
|
||||
if (result.startsWith('/')) {
|
||||
return result.mid(1);
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}();
|
||||
const auto path = _item->_file;
|
||||
const auto slashPosition = path.lastIndexOf('/');
|
||||
const auto parentPath = slashPosition >= 0 ? path.left(slashPosition) : QString();
|
||||
|
@ -52,11 +44,7 @@ PropagateRemoteMkdir::PropagateRemoteMkdir(OwncloudPropagator *propagator, const
|
|||
return;
|
||||
}
|
||||
|
||||
const auto account = propagator->account();
|
||||
|
||||
if (account->capabilities().clientSideEncryptionAvailable() &&
|
||||
parentRec.isValid() &&
|
||||
parentRec._isE2eEncrypted) {
|
||||
if (hasEncryptedAncestor()) {
|
||||
_parallelism = WaitForFinished;
|
||||
}
|
||||
}
|
||||
|
@ -142,14 +130,6 @@ void PropagateRemoteMkdir::setDeleteExisting(bool enabled)
|
|||
|
||||
void PropagateRemoteMkdir::slotMkdir()
|
||||
{
|
||||
const auto rootPath = [=]() {
|
||||
const auto result = propagator()->remotePath();
|
||||
if (result.startsWith('/')) {
|
||||
return result.mid(1);
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}();
|
||||
const auto path = _item->_file;
|
||||
const auto slashPosition = path.lastIndexOf('/');
|
||||
const auto parentPath = slashPosition >= 0 ? path.left(slashPosition) : QString();
|
||||
|
@ -161,21 +141,7 @@ void PropagateRemoteMkdir::slotMkdir()
|
|||
return;
|
||||
}
|
||||
|
||||
const auto hasEncryptedAncestor = [=] {
|
||||
auto pathComponents = parentPath.split('/');
|
||||
while (!pathComponents.isEmpty()) {
|
||||
SyncJournalFileRecord rec;
|
||||
propagator()->_journal->getFileRecord(pathComponents.join('/'), &rec);
|
||||
if (rec.isValid() && rec._isE2eEncrypted) {
|
||||
return true;
|
||||
}
|
||||
pathComponents.removeLast();
|
||||
}
|
||||
return false;
|
||||
}();
|
||||
|
||||
const auto account = propagator()->account();
|
||||
if (!account->capabilities().clientSideEncryptionAvailable() || !hasEncryptedAncestor) {
|
||||
if (!hasEncryptedAncestor()) {
|
||||
slotStartMkcolJob();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -206,11 +206,7 @@ PropagateUploadFileCommon::PropagateUploadFileCommon(OwncloudPropagator *propaga
|
|||
return;
|
||||
}
|
||||
|
||||
const auto account = propagator->account();
|
||||
|
||||
if (account->capabilities().clientSideEncryptionAvailable() &&
|
||||
parentRec.isValid() &&
|
||||
parentRec._isE2eEncrypted) {
|
||||
if (hasEncryptedAncestor()) {
|
||||
_parallelism = WaitForFinished;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue