diff options
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareController.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareControllerTest.php | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index f793d35e3ae..c4d9e739658 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -174,7 +174,7 @@ class ShareController extends Controller { * @param string $password * @return RedirectResponse|TemplateResponse|NotFoundResponse */ - public function authenticate($token, $redirect, $password = '') { + public function authenticate($token, $redirect = 'preview', $password = '') { // Check whether share exists try { diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 6dc577a354c..28f81395b9d 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -249,7 +249,7 @@ class ShareControllerTest extends \Test\TestCase { ->with('files_sharing.sharecontroller.showShare', ['token'=>'token']) ->willReturn('redirect'); - $response = $this->shareController->authenticate('token', 'validpassword'); + $response = $this->shareController->authenticate('token', 'preview', 'validpassword'); $expectedResponse = new RedirectResponse('redirect'); $this->assertEquals($expectedResponse, $response); } @@ -292,7 +292,7 @@ class ShareControllerTest extends \Test\TestCase { $data['errorMessage'] === 'Wrong password'; })); - $response = $this->shareController->authenticate('token', 'invalidpassword'); + $response = $this->shareController->authenticate('token', 'preview', 'invalidpassword'); $expectedResponse = new TemplateResponse($this->appName, 'authenticate', array('wrongpw' => true), 'guest'); $expectedResponse->throttle(); $this->assertEquals($expectedResponse, $response); @@ -323,7 +323,7 @@ class ShareControllerTest extends \Test\TestCase { $this->urlGenerator->expects($this->once()) ->method('linkToRoute') - ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken']) + ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken', 'redirect' => 'preview']) ->willReturn('redirect'); // Test without a not existing token @@ -505,12 +505,12 @@ class ShareControllerTest extends \Test\TestCase { $this->urlGenerator->expects($this->once()) ->method('linkToRoute') - ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken']) + ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken', 'redirect' => 'download']) ->willReturn('redirect'); // Test with a password protected share and no authentication $response = $this->shareController->downloadShare('validtoken'); - $expectedResponse = new RedirectResponse('redirect'); + $expectedResponse = new RedirectResponse('redirect', ''); $this->assertEquals($expectedResponse, $response); } |