Overlays: In case of folders, make sure to append slashes at end.

This fixes #2373
This commit is contained in:
Klaas Freitag 2014-12-12 16:38:07 +01:00
parent 7cc6c1a10f
commit c6daa8e59b
2 changed files with 14 additions and 1 deletions

View File

@ -580,6 +580,9 @@ bool Folder::estimateState(QString fn, csync_ftw_type_e t, SyncFileStatus* s)
return true;
}
}
if(!fn.endsWith(QLatin1Char('/'))) {
fn.append(QLatin1Char('/'));
}
if (Utility::doesSetContainPrefix(_stateTaintedFolders, fn)) {
qDebug() << Q_FUNC_INFO << "Folder is tainted, EVAL!" << fn;
s->set(SyncFileStatus::STATUS_EVAL);
@ -616,6 +619,9 @@ void Folder::watcherSlot(QString fn)
}
// Make it a relative path depending on the folder
QString relativePath = fn.remove(0, path().length());
if( !relativePath.endsWith(QLatin1Char('/'))) {
relativePath.append(QLatin1Char('/'));
}
qDebug() << Q_FUNC_INFO << fi.canonicalFilePath() << fn << relativePath;
_stateTaintedFolders.insert(relativePath);

View File

@ -1101,9 +1101,16 @@ void SyncEngine::setSelectiveSyncBlackList(const QStringList& list)
bool SyncEngine::estimateState(QString fn, csync_ftw_type_e t, SyncFileStatus* s)
{
Q_UNUSED(t);
QString pat(fn);
if( t == CSYNC_FTW_TYPE_DIR && ! fn.endsWith(QLatin1Char('/'))) {
pat.append(QLatin1Char('/'));
}
Q_FOREACH(const SyncFileItem &item, _syncedItems) {
//qDebug() << Q_FUNC_INFO << fn << item._file << fn.startsWith(item._file) << item._file.startsWith(fn);
if (item._file.startsWith(fn)) {
if (item._file.startsWith(pat) ||
item._file == fn /* the same directory or file */) {
qDebug() << Q_FUNC_INFO << "Setting" << fn << " to STATUS_EVAL";
s->set(SyncFileStatus::STATUS_EVAL);
return true;