mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 20:28:57 +03:00
Exclusion: Fix confusion with relative and absolute paths
This commit is contained in:
parent
7fe03c715d
commit
51a2e6c580
6 changed files with 19 additions and 9 deletions
|
@ -707,7 +707,7 @@ void Folder::removeFromSettings() const
|
|||
settings->remove(_definition.alias);
|
||||
}
|
||||
|
||||
bool Folder::isFileExcluded(const QString& fullPath) const
|
||||
bool Folder::isFileExcludedAbsolute(const QString& fullPath) const
|
||||
{
|
||||
QString myFullPath = fullPath;
|
||||
if (myFullPath.endsWith(QLatin1Char('/'))) {
|
||||
|
@ -724,6 +724,11 @@ bool Folder::isFileExcluded(const QString& fullPath) const
|
|||
return excl != CSYNC_NOT_EXCLUDED;
|
||||
}
|
||||
|
||||
bool Folder::isFileExcludedRelative(const QString& relativePath) const
|
||||
{
|
||||
return isFileExcludedAbsolute(path() + relativePath);
|
||||
}
|
||||
|
||||
void Folder::watcherSlot(QString fn)
|
||||
{
|
||||
// FIXME: On OS X we could not do this "if" since on OS X the file watcher ignores events for ourselves
|
||||
|
|
|
@ -200,7 +200,12 @@ public:
|
|||
/**
|
||||
* Returns whether a file inside this folder should be excluded.
|
||||
*/
|
||||
bool isFileExcluded(const QString& fullPath) const;
|
||||
bool isFileExcludedAbsolute(const QString& fullPath) const;
|
||||
|
||||
/**
|
||||
* Returns whether a file inside this folder should be excluded.
|
||||
*/
|
||||
bool isFileExcludedRelative(const QString& relativePath) const;
|
||||
|
||||
signals:
|
||||
void syncStateChange();
|
||||
|
|
|
@ -514,10 +514,9 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list_)
|
|||
QMutableListIterator<QString> it(list);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if (parentInfo->_folder->isFileExcluded(it.value())) {
|
||||
it.remove();
|
||||
} else {
|
||||
it.value().remove(pathToRemove);
|
||||
if (parentInfo->_folder->isFileExcludedRelative(it.value())) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ bool FolderWatcher::pathIsIgnored( const QString& path )
|
|||
if( !_folder ) return false;
|
||||
|
||||
#ifndef OWNCLOUD_TEST
|
||||
if (_folder->isFileExcluded(path)) {
|
||||
if (_folder->isFileExcludedAbsolute(path)) {
|
||||
qDebug() << "* Ignoring file" << path;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,9 @@ void SelectiveSyncTreeView::slotUpdateDirectories(QStringList list)
|
|||
QMutableListIterator<QString> it(list);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if (f.isFileExcluded(it.value())) {
|
||||
QString path = it.value();
|
||||
path.remove(pathToRemove);
|
||||
if (f.isFileExcludedRelative(path)) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +197,6 @@ void SelectiveSyncTreeView::slotUpdateDirectories(QStringList list)
|
|||
if (_oldBlackList == QStringList("/")) {
|
||||
_oldBlackList.clear();
|
||||
foreach (QString path, list) {
|
||||
path.remove(pathToRemove);
|
||||
if (path.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -540,7 +540,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
|
|||
}
|
||||
|
||||
// Is it excluded?
|
||||
if( folder->isFileExcluded(file) ) {
|
||||
if( folder->isFileExcludedAbsolute(file) ) {
|
||||
return SyncFileStatus(SyncFileStatus::STATUS_IGNORE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue