mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Prevent double slashes in group folder path parsing
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
bfaf526ad5
commit
4dd7ca30e3
1 changed files with 10 additions and 3 deletions
|
@ -339,15 +339,22 @@ void User::parseNewGroupFolderPath(const QString &mountPoint)
|
||||||
if (mountPoint.isEmpty()) {
|
if (mountPoint.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto mountPointSplit = mountPoint.split(QLatin1Char('/'), Qt::SkipEmptyParts);
|
|
||||||
|
auto sanitisedMountPoint = mountPoint;
|
||||||
|
sanitisedMountPoint.replace("//", "/");
|
||||||
|
auto mountPointSplit = sanitisedMountPoint.split('/', Qt::SkipEmptyParts);
|
||||||
|
|
||||||
if (mountPointSplit.isEmpty()) {
|
if (mountPointSplit.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto groupFolderName = mountPointSplit.takeLast();
|
const auto groupFolderName = mountPointSplit.takeLast();
|
||||||
const auto parentPath = mountPointSplit.join(QLatin1Char('/'));
|
const auto parentPath = mountPointSplit.join('/');
|
||||||
_trayFolderInfos.push_back(QVariant::fromValue(TrayFolderInfo{groupFolderName, parentPath, mountPoint, TrayFolderInfo::GroupFolder}));
|
const auto folderInfo = TrayFolderInfo(
|
||||||
|
groupFolderName, parentPath, sanitisedMountPoint, TrayFolderInfo::GroupFolder
|
||||||
|
);
|
||||||
|
const auto folderInfoVariant = QVariant::fromValue(folderInfo);
|
||||||
|
_trayFolderInfos.push_back(folderInfoVariant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void User::prePendGroupFoldersWithLocalFolder()
|
void User::prePendGroupFoldersWithLocalFolder()
|
||||||
|
|
Loading…
Reference in a new issue