diff options
author | Robin Appelman <robin@icewind.nl> | 2024-01-17 17:47:01 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-01-17 17:47:01 +0100 |
commit | 7bf82fc312acb775bf150ce506d16a05989cd43e (patch) | |
tree | 54548cd8f76e267c720604bb38854effd0082a39 /core/Command/Info | |
parent | 5de3028f667afb807d1c682238340208e56d6b91 (diff) | |
download | nextcloud-server-7bf82fc312acb775bf150ce506d16a05989cd43e.tar.gz nextcloud-server-7bf82fc312acb775bf150ce506d16a05989cd43e.zip |
add key location to info:file output
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'core/Command/Info')
-rw-r--r-- | core/Command/Info/File.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index d62feeb5a17..8eecf383070 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -5,10 +5,12 @@ 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; use OCP\Files\IHomeStorage; +use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountPoint; use OCP\Files\Node; use OCP\Files\NotFoundException; @@ -23,13 +25,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 +59,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 location at: " . $keyPath); + } + } $output->writeln(" size: " . Util::humanFileSize($node->getSize())); $output->writeln(" etag: " . $node->getEtag()); if ($node instanceof Folder) { |