This could only work at the root of the sync folder where the record for
the parent folder would be invalid. Otherwise the negation would be
wrong... assuming you can add a file only if the permission is not
there.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
const auto parentDir = fileData.parentFolder();
const auto parentRecord = parentDir.journalRecord();
const bool canAddToDir =
- (fileInfo.isFile() && !parentRecord._remotePerm.hasPermission(RemotePermissions::CanAddFile))
- || (fileInfo.isDir() && !parentRecord._remotePerm.hasPermission(RemotePermissions::CanAddSubDirectories));
+ !parentRecord.isValid() // We're likely at the root of the sync folder, got to assume we can add there
+ || (fileInfo.isFile() && parentRecord._remotePerm.hasPermission(RemotePermissions::CanAddFile))
+ || (fileInfo.isDir() && parentRecord._remotePerm.hasPermission(RemotePermissions::CanAddSubDirectories));
const bool canChangeFile =
!isOnTheServer
|| (record._remotePerm.hasPermission(RemotePermissions::CanDelete)