Skip to content

Commit 77a5491

Browse files
committed
Make sure the UID is correctly cased
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 96f8f20 commit 77a5491

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

apps/files/lib/Command/TransferOwnership.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use OC\Files\View;
2929
use OCP\Files\FileInfo;
3030
use OCP\Files\Mount\IMountManager;
31+
use OCP\IUser;
3132
use OCP\IUserManager;
3233
use OCP\Share\IManager;
3334
use OCP\Share\IShare;
@@ -92,15 +93,22 @@ protected function configure() {
9293
protected function execute(InputInterface $input, OutputInterface $output) {
9394
$this->sourceUser = $input->getArgument('source-user');
9495
$this->destinationUser = $input->getArgument('destination-user');
95-
if (!$this->userManager->userExists($this->sourceUser)) {
96+
$source = $this->userManager->get($this->sourceUser);
97+
$destination = $this->userManager->get($this->destinationUser);
98+
99+
if (!$source instanceof IUser) {
96100
$output->writeln("<error>Unknown source user $this->sourceUser</error>");
97101
return;
98102
}
99-
if (!$this->userManager->userExists($this->destinationUser)) {
103+
104+
if (!$destination instanceof IUser) {
100105
$output->writeln("<error>Unknown destination user $this->destinationUser</error>");
101106
return;
102107
}
103-
108+
109+
$this->sourceUser = $source->getUID();
110+
$this->destinationUser = $destination->getUID();
111+
104112
// target user has to be ready
105113
if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) {
106114
$output->writeln("<error>The target user is not ready to accept files. The user has at least to be logged in once.</error>");

0 commit comments

Comments
 (0)