Skip to content

Commit 8e46f74

Browse files
authored
Merge pull request #899 from nextcloud/fix/early-bail-out-on-non-existing-file
fix(cli): Abort early if file does not exist
2 parents c3d2a3f + 93e6ffb commit 8e46f74

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/Command/Import.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4848
$io = new SymfonyStyle($input, $output);
4949

5050
try {
51+
$path = $input->getArgument('archive');
52+
if (!file_exists($path)) {
53+
$io->error("File {$path} could not be found");
54+
$io->writeln('aborted.');
55+
return self::FAILURE;
56+
}
5157
$uid = $input->getOption('user');
5258
if (!empty($uid)) {
5359
$user = $this->userManager->get($uid);
@@ -64,7 +70,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6470
} else {
6571
$user = null;
6672
}
67-
$path = $input->getArgument('archive');
6873
$io->writeln("Importing from {$path}");
6974
$importSource = new ImportSource($path);
7075
$this->migrationService->import($importSource, $user, $io);

0 commit comments

Comments
 (0)