@@ -1055,7 +1055,7 @@ public function getInheritedShares(string $path): DataResponse {
10551055 }
10561056
10571057 if (!($ node ->getPermissions () & Constants::PERMISSION_SHARE )) {
1058- throw new SharingRightsException ('no sharing rights on this item ' );
1058+ throw new SharingRightsException ($ this -> l -> t ( 'no sharing rights on this item ' ) );
10591059 }
10601060
10611061 // The current top parent we have access to
@@ -1171,7 +1171,7 @@ public function updateShare(
11711171 }
11721172
11731173 if (!$ this ->canEditShare ($ share )) {
1174- throw new OCSForbiddenException ('You are not allowed to edit incoming shares ' );
1174+ throw new OCSForbiddenException ($ this -> l -> t ( 'You are not allowed to edit incoming shares ' ) );
11751175 }
11761176
11771177 if (
@@ -1218,7 +1218,7 @@ public function updateShare(
12181218 */
12191219
12201220 if ($ share ->getSharedBy () !== $ this ->currentUser ) {
1221- throw new OCSForbiddenException ('You are not allowed to edit link shares that you don \'t own ' );
1221+ throw new OCSForbiddenException ($ this -> l -> t ( 'You are not allowed to edit link shares that you don \'t own ' ) );
12221222 }
12231223
12241224 // Update hide download state
@@ -1640,7 +1640,7 @@ private function parseDate(string $expireDate): \DateTime {
16401640 // Make sure it expires at midnight in owner timezone
16411641 $ date ->setTime (0 , 0 , 0 );
16421642 } catch (\Exception $ e ) {
1643- throw new \Exception ('Invalid date. Format must be YYYY-MM-DD ' );
1643+ throw new \Exception ($ this -> l -> t ( 'Invalid date. Format must be YYYY-MM-DD ' ) );
16441644 }
16451645
16461646 return $ date ;
@@ -1845,7 +1845,7 @@ private function getSharesFromNode(string $viewer, $node, bool $reShares): array
18451845 */
18461846 private function confirmSharingRights (Node $ node ): void {
18471847 if (!$ this ->hasResharingRights ($ this ->currentUser , $ node )) {
1848- throw new SharingRightsException (' no sharing rights on this item ' );
1848+ throw new SharingRightsException ($ this -> l -> t ( ' No sharing rights on this item ') );
18491849 }
18501850 }
18511851
@@ -2008,21 +2008,14 @@ private function setShareAttributes(IShare $share, ?string $attributesString) {
20082008 $ formattedShareAttributes = \json_decode ($ attributesString , true );
20092009 if (is_array ($ formattedShareAttributes )) {
20102010 foreach ($ formattedShareAttributes as $ formattedAttr ) {
2011- // Legacy handling of the 'enabled' attribute
2012- if (array_key_exists ('enabled ' , $ formattedAttr )) {
2013- $ formattedAttr ['value ' ] = is_string ($ formattedAttr ['enabled ' ])
2014- ? (bool ) \json_decode ($ formattedAttr ['enabled ' ])
2015- : $ formattedAttr ['enabled ' ];
2016- }
2017-
20182011 $ newShareAttributes ->setAttribute (
20192012 $ formattedAttr ['scope ' ],
20202013 $ formattedAttr ['key ' ],
20212014 $ formattedAttr ['value ' ],
20222015 );
20232016 }
20242017 } else {
2025- throw new OCSBadRequestException ('Invalid share attributes provided: \" ' . $ attributesString . ' \" ' );
2018+ throw new OCSBadRequestException ($ this -> l -> t ( 'Invalid share attributes provided: "%s" ' , [ $ attributesString]) );
20262019 }
20272020 }
20282021 $ share ->setAttributes ($ newShareAttributes );
@@ -2044,10 +2037,10 @@ private function checkInheritedAttributes(IShare $share): void {
20442037 if ($ storage instanceof Wrapper) {
20452038 $ storage = $ storage ->getInstanceOfStorage (SharedStorage::class);
20462039 if ($ storage === null ) {
2047- throw new \RuntimeException ('Should not happen, instanceOfStorage but getInstanceOfStorage return null ' );
2040+ throw new \RuntimeException ($ this -> l -> t ( 'Should not happen, instanceOfStorage but getInstanceOfStorage return null ' ) );
20482041 }
20492042 } else {
2050- throw new \RuntimeException ('Should not happen, instanceOfStorage but not a wrapper ' );
2043+ throw new \RuntimeException ($ this -> l -> t ( 'Should not happen, instanceOfStorage but not a wrapper ' ) );
20512044 }
20522045 /** @var \OCA\Files_Sharing\SharedStorage $storage */
20532046 $ inheritedAttributes = $ storage ->getShare ()->getAttributes ();
@@ -2085,15 +2078,15 @@ public function sendShareEmail(string $id, $password = ''): DataResponse {
20852078 }
20862079
20872080 if (!$ this ->canEditShare ($ share )) {
2088- throw new OCSForbiddenException ('You are not allowed to send mail notifications ' );
2081+ throw new OCSForbiddenException ($ this -> l -> t ( 'You are not allowed to send mail notifications ' ) );
20892082 }
20902083
20912084 // For mail and link shares, the user must be
20922085 // the owner of the share, not only the file owner.
20932086 if ($ share ->getShareType () === IShare::TYPE_EMAIL
20942087 || $ share ->getShareType () === IShare::TYPE_LINK ) {
20952088 if ($ share ->getSharedBy () !== $ this ->currentUser ) {
2096- throw new OCSForbiddenException ('You are not allowed to send mail notifications ' );
2089+ throw new OCSForbiddenException ($ this -> l -> t ( 'You are not allowed to send mail notifications ' ) );
20972090 }
20982091 }
20992092
0 commit comments