diff options
author | Robin Appelman <robin@icewind.nl> | 2024-01-17 17:47:01 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-02-01 15:32:33 +0100 |
commit | edaa4363453351641356058a63495f85cda77e02 (patch) | |
tree | 5700d5c177409e141f7b7be845477e85b7be1f7c /core/Command | |
parent | 82e02a7f9633277c2fb15af9d6d78333294aecc7 (diff) | |
download | nextcloud-server-edaa4363453351641356058a63495f85cda77e02.tar.gz nextcloud-server-edaa4363453351641356058a63495f85cda77e02.zip |
add key location to info:file output
Signed-off-by: Robin Appelman <robin@icewind.nl>
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) { |