mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 06:45:49 +03:00
Folder wizard: Fix infinite loop for bad paths #7041
This commit is contained in:
parent
93afc2a04b
commit
83268c255a
1 changed files with 10 additions and 1 deletions
|
@ -1479,7 +1479,16 @@ static QString canonicalPath(const QString &path)
|
|||
{
|
||||
QFileInfo selFile(path);
|
||||
if (!selFile.exists()) {
|
||||
return canonicalPath(selFile.dir().path()) + '/' + selFile.fileName();
|
||||
const auto parentPath = selFile.dir().path();
|
||||
|
||||
// It's possible for the parentPath to match the path
|
||||
// (possibly we've arrived at a non-existant drive root on Windows)
|
||||
// and recursing would be fatal.
|
||||
if (parentPath == path) {
|
||||
return path;
|
||||
}
|
||||
|
||||
return canonicalPath(parentPath) + '/' + selFile.fileName();
|
||||
}
|
||||
return selFile.canonicalFilePath();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue