diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-09-21 13:36:52 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-09-22 13:50:48 +0300 |
commit | 7d9e5082b1e5cf501c9e1ad95d1562740c2cb106 (patch) | |
tree | 98922477933a49322a1558269f9e39b4e6c3a05f /src | |
parent | 0919a2611edc20ce9dd7cb1eda3edc83522ffd3d (diff) |
Don't crash if sync root is not read/writable
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/folder.cpp | 9 | ||||
-rw-r--r-- | src/gui/folderstatusmodel.cpp | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 0dc9026e1..33f531d17 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -175,7 +175,7 @@ bool Folder::checkLocalPath() _canonicalLocalPath.append('/'); } - if (fi.isDir() && fi.isReadable()) { + if (fi.isDir() && fi.isReadable() && fi.isWritable()) { qCDebug(lcFolder) << "Checked local path ok"; } else { QString error; @@ -186,6 +186,8 @@ bool Folder::checkLocalPath() error = tr("%1 should be a folder but is not.").arg(_definition.localPath); } else if (!fi.isReadable()) { error = tr("%1 is not readable.").arg(_definition.localPath); + } else if (!fi.isWritable()) { + error = tr("%1 is not writable.").arg(_definition.localPath); } if (!error.isEmpty()) { _syncResult.appendErrorString(error); @@ -1210,9 +1212,10 @@ void Folder::setSaveBackwardsCompatible(bool save) void Folder::registerFolderWatcher() { - if (_folderWatcher) + if (!ok()) { return; - if (!QDir(path()).exists()) + } + if (_folderWatcher) return; _folderWatcher.reset(new FolderWatcher(this)); diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 259e8b4af..0d2d13cb2 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -542,7 +542,7 @@ bool FolderStatusModel::canFetchMore(const QModelIndex &parent) const // Keep showing the error to the user, it will be hidden when the account reconnects return false; } - if (info->_folder && !info->_folder->supportsSelectiveSync()) { + if (info->_folder && info->_folder->ok() && !info->_folder->supportsSelectiveSync()) { // Selective sync is hidden in that case return false; } |