Permissions: fix restoring subdirectories

The sync item vector must be sorted before we call checkForPermission
This commit is contained in:
Olivier Goffart 2014-06-27 13:34:15 +02:00
parent 9066ad5790
commit 09881040a3
2 changed files with 7 additions and 5 deletions

View file

@ -216,14 +216,13 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItem& item) {
return 0;
}
void OwncloudPropagator::start(const SyncFileItemVector& _syncedItems)
void OwncloudPropagator::start(const SyncFileItemVector& items)
{
/* This builds all the job needed for the propagation.
* Each directories is a PropagateDirectory job, which contains the files in it.
* In order to do that we sort the items by destination. and loop over it. When we enter a
* directory, we can create the directory job and push it on the stack. */
SyncFileItemVector items = _syncedItems;
std::sort(items.begin(), items.end());
* In order to do that we loop over the items. (which are sorted by destination)
* When we enter adirectory, we can create the directory job and push it on the stack. */
_rootJob.reset(new PropagateDirectory(this));
QStack<QPair<QString /* directory name */, PropagateDirectory* /* job */> > directories;
directories.push(qMakePair(QString(), _rootJob.data()));

View file

@ -557,6 +557,9 @@ void SyncEngine::slotUpdateFinished(int updateResult)
it->_file = adjustRenamedPath(it->_file);
}
// Sort items per destination
std::sort(_syncedItems.begin(), _syncedItems.end());
// make sure everything is allowed
checkForPermission();