From: Kevin Ottens Date: Wed, 7 Oct 2020 15:47:48 +0000 (+0200) Subject: Repair the canAddToDir logic X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~95^2~8 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=26d62a9712b8fa147813e57c2b490ccbc695bff8;p=nextcloud-desktop.git Repair the canAddToDir logic 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 --- diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 3d9b43d13..e7bb0fa47 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -891,8 +891,9 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe 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)