From b4f8bd3d429a09698625f2400eb44c3529ff081c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Apr 2024 14:31:45 +0200 Subject: [PATCH] fix(sharing): Don't change the type of the controller argument [EA] New value type (\DateTime) is not matching the resolved parameter type and might introduce types-related false-positives. Signed-off-by: Joas Schilling --- .../lib/Controller/ShareAPIController.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 759b19060c23b..373ea797a086f 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -620,8 +620,8 @@ public function createShare( if ($expireDate !== null) { if ($expireDate !== '') { try { - $expireDate = $this->parseDate($expireDate); - $share->setExpirationDate($expireDate); + $expireDateTime = $this->parseDate($expireDate); + $share->setExpirationDate($expireDateTime); } catch (\Exception $e) { throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); } @@ -718,10 +718,6 @@ public function createShare( $share->setSharedWith($shareWith); $share->setPermissions($permissions); -<<<<<<< HEAD - -======= ->>>>>>> ec8a0a6267d (fix(shareApiController): avoid duplicated expiryDate operations) $share->setSharedWithDisplayName($this->getCachedFederatedDisplayName($shareWith, false)); } elseif ($shareType === IShare::TYPE_REMOTE_GROUP) { if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) { @@ -734,10 +730,6 @@ public function createShare( $share->setSharedWith($shareWith); $share->setPermissions($permissions); -<<<<<<< HEAD - -======= ->>>>>>> ec8a0a6267d (fix(shareApiController): avoid duplicated expiryDate operations) } elseif ($shareType === IShare::TYPE_CIRCLE) { if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { throw new OCSNotFoundException($this->l->t('You cannot share to a Circle if the app is not enabled'));