Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] feat: Improve encryption mode detection in occ info:file #47559

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions core/Command/Info/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand Down Expand Up @@ -61,15 +62,21 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$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);
} else {
$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) {
Expand Down
Loading