]> source.dussan.org Git - nextcloud-server.git/commitdiff
feat: Improve encryption mode detection in occ info:file 47559/head
authorLouis Chemineau <louis@chmn.me>
Mon, 26 Aug 2024 17:28:44 +0000 (19:28 +0200)
committerLouis Chemineau <louis@chmn.me>
Wed, 28 Aug 2024 09:25:33 +0000 (11:25 +0200)
Signed-off-by: Louis Chemineau <louis@chmn.me>
core/Command/Info/File.php

index e86d8d0a5bd2da958152639a2054e9b994f59e9d..5aca892547b02664d0efbf95cfca92cc8fcedbb4 100644 (file)
@@ -11,6 +11,7 @@ use OC\Files\ObjectStore\ObjectStoreStorage;
 use OC\Files\View;
 use OCA\Files_External\Config\ExternalMountPoint;
 use OCA\GroupFolders\Mount\GroupMountPoint;
+use OCP\Files\File as OCPFile;
 use OCP\Files\Folder;
 use OCP\Files\IHomeStorage;
 use OCP\Files\Mount\IMountPoint;
@@ -61,8 +62,9 @@ class File extends Command {
                $output->writeln("  fileid: " . $node->getId());
                $output->writeln("  mimetype: " . $node->getMimetype());
                $output->writeln("  modified: " . (string)$this->l10n->l("datetime", $node->getMTime()));
-               $output->writeln("  " . ($node->isEncrypted() ? "encrypted" : "not encrypted"));
-               if ($node->isEncrypted()) {
+
+               if ($node instanceof OCPFile && $node->isEncrypted()) {
+                       $output->writeln('  ' . 'server-side encrypted: yes');
                        $keyPath = $this->encryptionUtil->getFileKeyDir('', $node->getPath());
                        if ($this->rootView->file_exists($keyPath)) {
                                $output->writeln("    encryption key at: " . $keyPath);
@@ -70,6 +72,11 @@ class File extends Command {
                                $output->writeln("    <error>encryption key not found</error> should be located at: " . $keyPath);
                        }
                }
+
+               if ($node instanceof Folder && $node->isEncrypted() || $node instanceof OCPFile && $node->getParent()->isEncrypted()) {
+                       $output->writeln('  ' . 'end-to-end encrypted: yes');
+               }
+
                $output->writeln("  size: " . Util::humanFileSize($node->getSize()));
                $output->writeln("  etag: " . $node->getEtag());
                if ($node instanceof Folder) {