Skip to content

Commit 104aef3

Browse files
committed
refactor(core/Command): Port away from View
Use IRootFolder instead. Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
1 parent f450cda commit 104aef3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/Command/Info/File.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
use OC\Files\ObjectStore\PrimaryObjectStoreConfig;
1212
use OC\Files\Storage\Wrapper\Encryption;
1313
use OC\Files\Storage\Wrapper\Wrapper;
14-
use OC\Files\View;
1514
use OCA\Files_External\Config\ExternalMountPoint;
1615
use OCA\GroupFolders\Mount\GroupMountPoint;
1716
use OCP\Files\File as OCPFile;
1817
use OCP\Files\Folder;
1918
use OCP\Files\IHomeStorage;
19+
use OCP\Files\IRootFolder;
2020
use OCP\Files\Mount\IMountPoint;
2121
use OCP\Files\Node;
2222
use OCP\Files\NotFoundException;
@@ -31,17 +31,16 @@
3131

3232
class File extends Command {
3333
private IL10N $l10n;
34-
private View $rootView;
3534

3635
public function __construct(
3736
IFactory $l10nFactory,
3837
private FileUtils $fileUtils,
3938
private \OC\Encryption\Util $encryptionUtil,
4039
private PrimaryObjectStoreConfig $objectStoreConfig,
40+
private IRootFolder $rootFolder,
4141
) {
4242
$this->l10n = $l10nFactory->get('core');
4343
parent::__construct();
44-
$this->rootView = new View();
4544
}
4645

4746
protected function configure(): void {
@@ -70,9 +69,10 @@ public function execute(InputInterface $input, OutputInterface $output): int {
7069
if ($node instanceof OCPFile && $node->isEncrypted()) {
7170
$output->writeln(' ' . 'server-side encrypted: yes');
7271
$keyPath = $this->encryptionUtil->getFileKeyDir('', $node->getPath());
73-
if ($this->rootView->file_exists($keyPath)) {
72+
try {
73+
$this->rootFolder->get($keyPath);
7474
$output->writeln(' encryption key at: ' . $keyPath);
75-
} else {
75+
} catch (NotFoundException $e) {
7676
$output->writeln(' <error>encryption key not found</error> should be located at: ' . $keyPath);
7777
}
7878
$storage = $node->getStorage();

0 commit comments

Comments
 (0)