@@ -48,7 +48,7 @@ class ShareInfoController extends ApiController {
4848 * @param IRequest $request
4949 * @param IManager $shareManager
5050 */
51- public function __construct ($ appName ,
51+ public function __construct (string $ appName ,
5252 IRequest $ request ,
5353 IManager $ shareManager ) {
5454 parent ::__construct ($ appName , $ request );
@@ -59,26 +59,32 @@ public function __construct($appName,
5959 /**
6060 * @PublicPage
6161 * @NoCSRFRequired
62+ * @BruteForceProtection(action=shareinfo)
6263 *
6364 * @param string $t
6465 * @param null $password
6566 * @param null $dir
6667 * @return JSONResponse
67- * @throws ShareNotFound
6868 */
6969 public function info ($ t , $ password = null , $ dir = null ) {
7070 try {
7171 $ share = $ this ->shareManager ->getShareByToken ($ t );
7272 } catch (ShareNotFound $ e ) {
73- return new JSONResponse ([], Http::STATUS_NOT_FOUND );
73+ $ response = new JSONResponse ([], Http::STATUS_NOT_FOUND );
74+ $ response ->throttle (['token ' => $ t ]);
75+ return $ response ;
7476 }
7577
7678 if ($ share ->getPassword () && !$ this ->shareManager ->checkPassword ($ share , $ password )) {
77- return new JSONResponse ([], Http::STATUS_FORBIDDEN );
79+ $ response = new JSONResponse ([], Http::STATUS_FORBIDDEN );
80+ $ response ->throttle (['token ' => $ t ]);
81+ return $ response ;
7882 }
7983
8084 if (!($ share ->getPermissions () & Constants::PERMISSION_READ )) {
81- return new JSONResponse ([], Http::STATUS_FORBIDDEN );
85+ $ response = new JSONResponse ([], Http::STATUS_FORBIDDEN );
86+ $ response ->throttle (['token ' => $ t ]);
87+ return $ response ;
8288 }
8389
8490 $ permissionMask = $ share ->getPermissions ();
0 commit comments