mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-28 07:54:49 +03:00
Folder: Cannonicalize the path
This is important because we compare the paths from the file system watcher if it starts with this path. Same in the SocketAPI where we need to use cannonical paths in the REGISTER_PATH command, as the plugin themself will do this comparison. Issue #5116
This commit is contained in:
parent
904cd46f75
commit
c2cb729fee
2 changed files with 8 additions and 6 deletions
|
@ -124,6 +124,11 @@ void Folder::checkLocalPath()
|
||||||
{
|
{
|
||||||
const QFileInfo fi(_definition.localPath);
|
const QFileInfo fi(_definition.localPath);
|
||||||
|
|
||||||
|
_canonicalLocalPath = fi.canonicalFilePath();
|
||||||
|
if( !_canonicalLocalPath.endsWith('/') ) {
|
||||||
|
_canonicalLocalPath.append('/');
|
||||||
|
}
|
||||||
|
|
||||||
if( fi.isDir() && fi.isReadable() ) {
|
if( fi.isDir() && fi.isReadable() ) {
|
||||||
qDebug() << "Checked local path ok";
|
qDebug() << "Checked local path ok";
|
||||||
} else {
|
} else {
|
||||||
|
@ -161,11 +166,7 @@ QString Folder::alias() const
|
||||||
|
|
||||||
QString Folder::path() const
|
QString Folder::path() const
|
||||||
{
|
{
|
||||||
QString p(_definition.localPath);
|
return _canonicalLocalPath;
|
||||||
if( ! p.endsWith('/') ) {
|
|
||||||
p.append('/');
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Folder::shortGuiLocalPath() const
|
QString Folder::shortGuiLocalPath() const
|
||||||
|
@ -198,7 +199,7 @@ void Folder::setIgnoreHiddenFiles(bool ignore)
|
||||||
|
|
||||||
QString Folder::cleanPath()
|
QString Folder::cleanPath()
|
||||||
{
|
{
|
||||||
QString cleanedPath = QDir::cleanPath(_definition.localPath);
|
QString cleanedPath = QDir::cleanPath(_canonicalLocalPath);
|
||||||
|
|
||||||
if(cleanedPath.length() == 3 && cleanedPath.endsWith(":/"))
|
if(cleanedPath.length() == 3 && cleanedPath.endsWith(":/"))
|
||||||
cleanedPath.remove(2,1);
|
cleanedPath.remove(2,1);
|
||||||
|
|
|
@ -288,6 +288,7 @@ private:
|
||||||
|
|
||||||
AccountStatePtr _accountState;
|
AccountStatePtr _accountState;
|
||||||
FolderDefinition _definition;
|
FolderDefinition _definition;
|
||||||
|
QString _canonicalLocalPath; // As returned with QFileInfo:canonicalFilePath. Always ends with "/"
|
||||||
|
|
||||||
SyncResult _syncResult;
|
SyncResult _syncResult;
|
||||||
QScopedPointer<SyncEngine> _engine;
|
QScopedPointer<SyncEngine> _engine;
|
||||||
|
|
Loading…
Reference in a new issue