Change EncryptFolderJob path convention

It had a different path convention than all the other jobs, most likely
for legacy reasons because of the tight coupling it had to the settings
dialog.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-12-07 18:12:45 +01:00
parent ee8e0fa332
commit b667bdda14
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
3 changed files with 8 additions and 4 deletions

View file

@ -302,7 +302,12 @@ void AccountSettings::slotMarkSubfolderEncrypted(const FolderStatusModel::SubFol
return;
}
auto job = new OCC::EncryptFolderJob(accountsState()->account(), folderInfo->_path, folderInfo->_fileId, this);
// Folder info have directory paths in Foo/Bar/ convention...
Q_ASSERT(!folderInfo->_path.startsWith('/') && folderInfo->_path.endsWith('/'));
// But EncryptFolderJob expects directory path Foo/Bar convention
const auto path = folderInfo->_path.chopped(1);
auto job = new OCC::EncryptFolderJob(accountsState()->account(), path, folderInfo->_fileId, this);
connect(job, &OCC::EncryptFolderJob::finished, this, &AccountSettings::slotEncryptFolderFinished);
job->start();
}

View file

@ -45,7 +45,7 @@ QString EncryptFolderJob::errorString() const
void EncryptFolderJob::slotEncryptionFlagSuccess(const QByteArray &fileId)
{
_account->e2e()->setFolderEncryptedStatus(_path, true);
_account->e2e()->setFolderEncryptedStatus(_path + '/', true);
auto lockJob = new LockEncryptFolderApiJob(_account, fileId, this);
connect(lockJob, &LockEncryptFolderApiJob::success,

View file

@ -240,8 +240,7 @@ void PropagateRemoteMkdir::slotMkcolJobFinished()
// We're expecting directory path in /Foo/Bar convention...
Q_ASSERT(_job->path().startsWith('/') && !_job->path().endsWith('/'));
// But encryption job expect it in Foo/Bar/ convention
// (otherwise we won't store the right string in the e2e object)
const auto path = QString(_job->path().mid(1) + '/');
const auto path = _job->path().mid(1);
auto job = new OCC::EncryptFolderJob(propagator()->account(), path, _item->_fileId, this);
connect(job, &OCC::EncryptFolderJob::finished, this, &PropagateRemoteMkdir::slotEncryptFolderFinished);