Merge pull request #2824 from nextcloud/e2ee-can-not-move-folder

Fix e2ee folder move issue
This commit is contained in:
Kevin Ottens 2021-01-14 15:12:17 +01:00 committed by GitHub
commit 314f714082
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -887,6 +887,11 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
qCInfo(lcDisco) << "Not a move, no item in db with inode" << localEntry.inode; qCInfo(lcDisco) << "Not a move, no item in db with inode" << localEntry.inode;
return false; return false;
} }
if (base._isE2eEncrypted || isInsideEncryptedTree()) {
return false;
}
if (base.isDirectory() != item->isDirectory()) { if (base.isDirectory() != item->isDirectory()) {
qCInfo(lcDisco) << "Not a move, types don't match" << base._type << item->_type << localEntry.type; qCInfo(lcDisco) << "Not a move, types don't match" << base._type << item->_type << localEntry.type;
return false; return false;
@ -1149,6 +1154,7 @@ void ProcessDirectoryJob::processFileFinalize(
} }
if (recurse) { if (recurse) {
auto job = new ProcessDirectoryJob(path, item, recurseQueryLocal, recurseQueryServer, this); auto job = new ProcessDirectoryJob(path, item, recurseQueryLocal, recurseQueryServer, this);
job->setInsideEncryptedTree(isInsideEncryptedTree() || item->_isEncrypted);
if (removed) { if (removed) {
job->setParent(_discoveryData); job->setParent(_discoveryData);
_discoveryData->_queuedDeletedDirectories[path._original] = job; _discoveryData->_queuedDeletedDirectories[path._original] = job;

View file

@ -88,6 +88,16 @@ public:
/** Start up to nbJobs, return the number of job started; emit finished() when done */ /** Start up to nbJobs, return the number of job started; emit finished() when done */
int processSubJobs(int nbJobs); int processSubJobs(int nbJobs);
void setInsideEncryptedTree(bool isInsideEncryptedTree)
{
_isInsideEncryptedTree = isInsideEncryptedTree;
}
bool isInsideEncryptedTree() const
{
return _isInsideEncryptedTree;
}
SyncFileItemPtr _dirItem; SyncFileItemPtr _dirItem;
private: private:
@ -273,6 +283,7 @@ private:
bool _childModified = false; // the directory contains modified item what would prevent deletion bool _childModified = false; // the directory contains modified item what would prevent deletion
bool _childIgnored = false; // The directory contains ignored item that would prevent deletion bool _childIgnored = false; // The directory contains ignored item that would prevent deletion
PinState _pinState = PinState::Unspecified; // The directory's pin-state, see computePinState() PinState _pinState = PinState::Unspecified; // The directory's pin-state, see computePinState()
bool _isInsideEncryptedTree = false; // this directory is encrypted or is within the tree of directories with root directory encrypted
signals: signals:
void finished(); void finished();