From: Kevin Ottens Date: Thu, 9 Jul 2020 10:56:19 +0000 (+0200) Subject: Properly register folder as encrypted during sync X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~80 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3ccac1b1beab1e3d8416380f170fe575bf06b192;p=nextcloud-desktop.git Properly register folder as encrypted during sync Turns out that when we added a new e2e folder during sync, we were passing the wrong path to the e2e object. We have several path convention in the sync code, just happened to be the wrong one. I still long for the day when we'll use the type system to deal with paths. All those strings are error-prone. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/propagateremotemkdir.cpp b/src/libsync/propagateremotemkdir.cpp index bdd7870d9..343310322 100644 --- a/src/libsync/propagateremotemkdir.cpp +++ b/src/libsync/propagateremotemkdir.cpp @@ -197,7 +197,14 @@ void PropagateRemoteMkdir::slotMkcolJobFinished() } else { // We still need to mark that folder encrypted propagator()->_activeJobList.append(this); - auto job = new OCC::EncryptFolderJob(propagator()->account(), _job->path(), _item->_fileId, this); + + // 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) + '/'); + + auto job = new OCC::EncryptFolderJob(propagator()->account(), path, _item->_fileId, this); connect(job, &OCC::EncryptFolderJob::finished, this, &PropagateRemoteMkdir::slotEncryptFolderFinished); job->start(); }