diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-02-23 19:36:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 19:36:25 +0100 |
commit | edc35f74c71b709eba70ef9eb2f25ef02b9c084c (patch) | |
tree | 7e56d5ea15d559ab2a24d4fce8050d23be4a59c5 /core/Command | |
parent | 04cb02b96840e7ffd4915b3ab527084146b1c0d4 (diff) | |
parent | edaa4363453351641356058a63495f85cda77e02 (diff) | |
download | nextcloud-server-edc35f74c71b709eba70ef9eb2f25ef02b9c084c.tar.gz nextcloud-server-edc35f74c71b709eba70ef9eb2f25ef02b9c084c.zip |
Merge pull request #42893 from nextcloud/file-info-key-location
Diffstat (limited to 'core/Command')
-rw-r--r-- | core/Command/Info/File.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index d62feeb5a17..4afda280370 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace OC\Core\Command\Info; use OC\Files\ObjectStore\ObjectStoreStorage; +use OC\Files\View; use OCA\Files_External\Config\ExternalMountPoint; use OCA\GroupFolders\Mount\GroupMountPoint; use OCP\Files\Folder; @@ -23,13 +24,16 @@ use Symfony\Component\Console\Output\OutputInterface; class File extends Command { private IL10N $l10n; + private View $rootView; public function __construct( IFactory $l10nFactory, private FileUtils $fileUtils, + private \OC\Encryption\Util $encryptionUtil ) { $this->l10n = $l10nFactory->get("core"); parent::__construct(); + $this->rootView = new View(); } protected function configure(): void { @@ -54,6 +58,14 @@ class File extends Command { $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()) { + $keyPath = $this->encryptionUtil->getFileKeyDir('', $node->getPath()); + if ($this->rootView->file_exists($keyPath)) { + $output->writeln(" encryption key at: " . $keyPath); + } else { + $output->writeln(" <error>encryption key not found</error> should be located at: " . $keyPath); + } + } $output->writeln(" size: " . Util::humanFileSize($node->getSize())); $output->writeln(" etag: " . $node->getEtag()); if ($node instanceof Folder) { |