Prevent double slashes in group folder path parsing

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
bugfix/locally-available-folders-open-in-browser-tray-header
Claudio Cambra 2024-05-10 13:13:38 +08:00
parent 9ac9eefc16
commit 280449ebf4
No known key found for this signature in database
GPG Key ID: C839200C384636B0
1 changed files with 10 additions and 3 deletions

View File

@ -338,15 +338,22 @@ void User::parseNewGroupFolderPath(const QString &mountPoint)
if (mountPoint.isEmpty()) {
return;
}
auto mountPointSplit = mountPoint.split(QLatin1Char('/'), Qt::SkipEmptyParts);
auto sanitisedMountPoint = mountPoint;
sanitisedMountPoint.replace("//", "/");
auto mountPointSplit = sanitisedMountPoint.split('/', Qt::SkipEmptyParts);
if (mountPointSplit.isEmpty()) {
return;
}
const auto groupFolderName = mountPointSplit.takeLast();
const auto parentPath = mountPointSplit.join(QLatin1Char('/'));
_trayFolderInfos.push_back(QVariant::fromValue(TrayFolderInfo{groupFolderName, parentPath, mountPoint, TrayFolderInfo::GroupFolder}));
const auto parentPath = mountPointSplit.join('/');
const auto folderInfo = TrayFolderInfo(
groupFolderName, parentPath, sanitisedMountPoint, TrayFolderInfo::GroupFolder
);
const auto folderInfoVariant = QVariant::fromValue(folderInfo);
_trayFolderInfos.push_back(folderInfoVariant);
}
void User::prePendGroupFoldersWithLocalFolder()