Skip to content

Commit

Permalink
Fix path logic for sync activities.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <blackslayer4@gmail.com>
  • Loading branch information
allexzander committed Sep 8, 2023
1 parent b3f9ff2 commit 0129253
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const Acco
if (acc && folder->accountState()->account() != acc) {
continue;
}
if (!serverPath.startsWith(folder->remotePath()))
if (!serverPath.startsWith(folder->remotePathTrailingSlash()))
continue;

QString path = folder->cleanPath() + '/';
Expand Down
4 changes: 2 additions & 2 deletions src/gui/tray/activitylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
if (!fileName.isEmpty()) {
const auto folder = FolderMan::instance()->folder(a._folder);

const QString relPath = folder ? folder->remotePath() + fileName : fileName;
const QString relPath = folder ? folder->remotePathTrailingSlash() + fileName : fileName;

const auto localFiles = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());

Expand Down Expand Up @@ -184,7 +184,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
if (!a._file.isEmpty()) {
const auto folder = FolderMan::instance()->folder(a._folder);

QString relPath = folder ? folder->remotePath() + a._file : a._file;
QString relPath = folder ? folder->remotePathTrailingSlash() + a._file : a._file;

const auto localFiles = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());

Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ void User::processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr
}

if(activity._fileAction != "file_deleted" && !item->isEmpty()) {
const auto localFiles = FolderMan::instance()->findFileInLocalFolders(item->_file, account());
const auto localFiles = FolderMan::instance()->findFileInLocalFolders(folder->remotePathTrailingSlash() + item->_file, account());
if (!localFiles.isEmpty()) {
const auto firstFilePath = localFiles.constFirst();
const auto itemJournalRecord = item->toSyncJournalFileRecordWithInode(firstFilePath);
Expand Down

0 comments on commit 0129253

Please sign in to comment.