mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 03:49:20 +03:00
parent
9f6d7eb587
commit
e46ab72718
2 changed files with 27 additions and 2 deletions
|
@ -558,7 +558,11 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
|
||||||
if( FileSystem::getModTime(fi.absoluteFilePath()) == Utility::qDateTimeToTime_t(rec._modtime) ) {
|
if( FileSystem::getModTime(fi.absoluteFilePath()) == Utility::qDateTimeToTime_t(rec._modtime) ) {
|
||||||
status.set(SyncFileStatus::STATUS_SYNC);
|
status.set(SyncFileStatus::STATUS_SYNC);
|
||||||
} else {
|
} else {
|
||||||
status.set(SyncFileStatus::STATUS_EVAL);
|
if (rec._remotePerm.isNull() || rec._remotePerm.contains("W") ) {
|
||||||
|
status.set(SyncFileStatus::STATUS_EVAL);
|
||||||
|
} else {
|
||||||
|
status.set(SyncFileStatus::STATUS_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug() << Q_FUNC_INFO << "Could not determine state for file" << fileName << "will set STATUS_NEW";
|
qDebug() << Q_FUNC_INFO << "Could not determine state for file" << fileName << "will set STATUS_NEW";
|
||||||
|
@ -577,6 +581,28 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
|
||||||
status.setSharedWithMe(true);
|
status.setSharedWithMe(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (status.tag() == SyncFileStatus::STATUS_NEW) {
|
||||||
|
// check the parent folder if it is shared and if it is allowed to create a file/dir within
|
||||||
|
QDir d( fi.path() );
|
||||||
|
auto parentPath = d.path();
|
||||||
|
auto dirRec = dbFileRecord_capi(folder, parentPath);
|
||||||
|
bool isDir = type == CSYNC_FTW_TYPE_DIR;
|
||||||
|
while( !d.isRoot() && !(d.exists() && dirRec.isValid()) ) {
|
||||||
|
d.cdUp(); // returns true if the dir exists.
|
||||||
|
|
||||||
|
parentPath = d.path();
|
||||||
|
// cut the folder path
|
||||||
|
dirRec = dbFileRecord_capi(folder, parentPath);
|
||||||
|
|
||||||
|
isDir = true;
|
||||||
|
}
|
||||||
|
if( dirRec.isValid() && !dirRec._remotePerm.isNull()) {
|
||||||
|
if( (isDir && !dirRec._remotePerm.contains("K"))
|
||||||
|
|| (!isDir && !dirRec._remotePerm.contains("C")) ) {
|
||||||
|
status.set(SyncFileStatus::STATUS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SyncFileStatus fileStatus(Folder *folder, const QString& systemFileName, c_strlist_t *excludes );
|
SyncFileStatus fileStatus(Folder *folder, const QString& systemFileName, c_strlist_t *excludes );
|
||||||
SyncJournalFileRecord dbFileRecord( Folder *folder, QString fileName );
|
|
||||||
SyncJournalFileRecord dbFileRecord_capi( Folder *folder, QString fileName );
|
SyncJournalFileRecord dbFileRecord_capi( Folder *folder, QString fileName );
|
||||||
SyncFileStatus recursiveFolderStatus(Folder *folder, const QString& fileName, c_strlist_t *excludes );
|
SyncFileStatus recursiveFolderStatus(Folder *folder, const QString& fileName, c_strlist_t *excludes );
|
||||||
SqlQuery *getSqlQuery( Folder *folder );
|
SqlQuery *getSqlQuery( Folder *folder );
|
||||||
|
|
Loading…
Reference in a new issue