@@ -188,7 +188,7 @@ protected function formatShare(IShare $share, ?Node $recipientNode = null): arra
188188 if ($ isOwnShare ) {
189189 $ result ['item_permissions ' ] = $ node ->getPermissions ();
190190 }
191-
191+
192192 // If we're on the recipient side, the node permissions
193193 // are bound to the share permissions. So we need to
194194 // adjust the permissions to the share permissions if necessary.
@@ -674,7 +674,7 @@ public function createShare(
674674 $ expireDateTime = $ this ->parseDate ($ expireDate );
675675 $ share ->setExpirationDate ($ expireDateTime );
676676 } catch (\Exception $ e ) {
677- throw new OCSNotFoundException ($ this -> l -> t ( ' Invalid date, date format must be YYYY-MM-DD ' ) );
677+ throw new OCSNotFoundException ($ e -> getMessage (), $ e );
678678 }
679679 } else {
680680 // Client sent empty string for expire date.
@@ -825,12 +825,11 @@ public function createShare(
825825 try {
826826 $ share = $ this ->shareManager ->createShare ($ share );
827827 } catch (GenericShareException $ e ) {
828- $ this ->logger ->error ($ e ->getMessage (), ['exception ' => $ e ]);
829828 $ code = $ e ->getCode () === 0 ? 403 : $ e ->getCode ();
830829 throw new OCSException ($ e ->getHint (), $ code );
831830 } catch (\Exception $ e ) {
832831 $ this ->logger ->error ($ e ->getMessage (), ['exception ' => $ e ]);
833- throw new OCSForbiddenException ($ e -> getMessage () , $ e );
832+ throw new OCSForbiddenException (' Failed to create share. ' , $ e );
834833 }
835834
836835 $ output = $ this ->formatShare ($ share );
@@ -1350,11 +1349,11 @@ public function updateShare(
13501349 $ share ->setExpirationDate (null );
13511350 } elseif ($ expireDate !== null ) {
13521351 try {
1353- $ expireDate = $ this ->parseDate ($ expireDate );
1352+ $ expireDateTime = $ this ->parseDate ($ expireDate );
1353+ $ share ->setExpirationDate ($ expireDateTime );
13541354 } catch (\Exception $ e ) {
13551355 throw new OCSBadRequestException ($ e ->getMessage (), $ e );
13561356 }
1357- $ share ->setExpirationDate ($ expireDate );
13581357 }
13591358
13601359 try {
@@ -1363,7 +1362,8 @@ public function updateShare(
13631362 $ code = $ e ->getCode () === 0 ? 403 : $ e ->getCode ();
13641363 throw new OCSException ($ e ->getHint (), (int )$ code );
13651364 } catch (\Exception $ e ) {
1366- throw new OCSBadRequestException ($ e ->getMessage (), $ e );
1365+ $ this ->logger ->error ($ e ->getMessage (), ['exception ' => $ e ]);
1366+ throw new OCSBadRequestException ('Failed to update share. ' , $ e );
13671367 }
13681368
13691369 return new DataResponse ($ this ->formatShare ($ share ));
@@ -1452,7 +1452,8 @@ public function acceptShare(string $id): DataResponse {
14521452 $ code = $ e ->getCode () === 0 ? 403 : $ e ->getCode ();
14531453 throw new OCSException ($ e ->getHint (), (int )$ code );
14541454 } catch (\Exception $ e ) {
1455- throw new OCSBadRequestException ($ e ->getMessage (), $ e );
1455+ $ this ->logger ->error ($ e ->getMessage (), ['exception ' => $ e ]);
1456+ throw new OCSBadRequestException ('Failed to accept share. ' , $ e );
14561457 }
14571458
14581459 return new DataResponse ();
0 commit comments