diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index 5b7206713e674..81d98040596fb 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -1242,7 +1242,8 @@ void SocketApi::sendEncryptFolderCommandMenuEntries(const QFileInfo &fileInfo, !fileData.folder->accountState()->account() || !fileData.folder->accountState()->account()->capabilities().clientSideEncryptionAvailable() || !FileSystem::isDir(fileInfo.absoluteFilePath()) || - isE2eEncryptedPath) { + isE2eEncryptedPath || + !fileData.isFolderEmpty()) { return; } @@ -1328,6 +1329,15 @@ QString SocketApi::FileData::folderRelativePathNoVfsSuffix() const return result; } +bool SocketApi::FileData::isFolderEmpty() const +{ + if (FileSystem::isDir(localPath)) { + const auto nativeFolder = QDir{localPath}; + return nativeFolder.isEmpty(); + } + return false; +} + SyncFileStatus SocketApi::FileData::syncFileStatus() const { if (!folder) diff --git a/src/gui/socketapi/socketapi.h b/src/gui/socketapi/socketapi.h index 7f25772cd9e3c..bf95d780cd821 100644 --- a/src/gui/socketapi/socketapi.h +++ b/src/gui/socketapi/socketapi.h @@ -98,6 +98,8 @@ private slots: // Relative path of the file locally, without any vfs suffix [[nodiscard]] QString folderRelativePathNoVfsSuffix() const; + [[nodiscard]] bool isFolderEmpty() const; + Folder *folder = nullptr; // Absolute path of the file locally. (May be a virtual file) QString localPath;