Skip to content

Commit

Permalink
Ensure we are using folder relative paths for synced folders that are…
Browse files Browse the repository at this point in the history
… not root to work correctly

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Dec 6, 2022
1 parent 5ef63db commit 4045b14
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/gui/editlocallyjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ void EditLocallyJob::proceedWithSetup()
}

_fileName = relPathSplit.last();
_folderRelativePath = _localFilePath.mid(_folderForFile->cleanPath().length() + 1);

_folderForFile = findFolderForFile(_relPath, _userId);

if (!_folderForFile) {
Expand Down Expand Up @@ -561,7 +559,7 @@ void EditLocallyJob::lockFile()
Q_ASSERT(_accountState->account());
Q_ASSERT(_folderForFile);

if (_accountState->account()->fileLockStatus(_folderForFile->journalDb(), _folderRelativePath) == SyncFileItem::LockStatus::LockedItem) {
if (_accountState->account()->fileLockStatus(_folderForFile->journalDb(), _relativePathToRemoteRoot) == SyncFileItem::LockStatus::LockedItem) {
fileLockSuccess(true);
return;
}
Expand All @@ -570,7 +568,7 @@ void EditLocallyJob::lockFile()

_folderConnections.append(connect(&_folderForFile->syncEngine(), &SyncEngine::itemCompleted,
this, [this](const SyncFileItemPtr &item) {
if (item->_file == _relPath && item->_locked == SyncFileItem::LockStatus::LockedItem) {
if (item->_file == _relativePathToRemoteRoot && item->_locked == SyncFileItem::LockStatus::LockedItem) {
fileLockSuccess();
}
}));
Expand All @@ -581,7 +579,8 @@ void EditLocallyJob::lockFile()
_folderForFile->accountState()->account()->setLockFileState(_relPath,
_folderForFile->journalDb(),
SyncFileItem::LockStatus::LockedItem);
_folderForFile->journalDb()->schedulePathForRemoteDiscovery(_relPath);

_folderForFile->syncEngine().setSingleItemDiscoveryOptions({_relPathParent == QStringLiteral("/") ? QString{} : _relPathParent, _relativePathToRemoteRoot, _fileParentItem});
FolderMan::instance()->forceSyncForFolder(_folderForFile);
}

Expand All @@ -597,7 +596,7 @@ void EditLocallyJob::fileLockSuccess(const bool existingLock)
qCDebug(lcEditLocallyJob()) << "File lock succeeded, showing notification" << _relPath;

SyncJournalFileRecord rec;
Q_ASSERT(_folderForFile->journalDb()->getFileRecord(_folderRelativePath, &rec));
Q_ASSERT(_folderForFile->journalDb()->getFileRecord(_relativePathToRemoteRoot, &rec));
Q_ASSERT(rec.isValid());
Q_ASSERT(rec._lockstate._locked);

Expand Down

0 comments on commit 4045b14

Please sign in to comment.