public function testShowShare() {
$note = 'personal note';
+ $filename = 'file1.txt';
$this->shareController->setToken('token');
$initiator->method('isEnabled')->willReturn(true);
$file = $this->createMock(File::class);
- $file->method('getName')->willReturn('file1.txt');
+ $file->method('getName')->willReturn($filename);
$file->method('getMimetype')->willReturn('text/plain');
$file->method('getSize')->willReturn(33);
$file->method('isReadable')->willReturn(true);
->setSharedBy('initiatorUID')
->setNode($file)
->setNote($note)
- ->setTarget('/file1.txt');
+ ->setTarget("/$filename");
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true);
$this->session->method('get')->with('public_link_authenticated')->willReturn('42');
$this->urlGenerator->expects($this->at(0))
->method('linkToRouteAbsolute')
- ->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token'])
+ ->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename])
->willReturn('downloadURL');
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true);
$response = $this->shareController->showShare();
$sharedTmplParams = [
'owner' => 'ownerUID',
- 'filename' => 'file1.txt',
- 'directory_path' => '/file1.txt',
+ 'filename' => $filename,
+ 'directory_path' => "/$filename",
'mimetype' => 'text/plain',
'dirToken' => 'token',
'sharingToken' => 'token',
public function testShowShareWithPrivateName() {
$note = 'personal note';
+ $filename = 'file1.txt';
$this->shareController->setToken('token');
$initiator->method('isEnabled')->willReturn(true);
$file = $this->createMock(File::class);
- $file->method('getName')->willReturn('file1.txt');
+ $file->method('getName')->willReturn($filename);
$file->method('getMimetype')->willReturn('text/plain');
$file->method('getSize')->willReturn(33);
$file->method('isReadable')->willReturn(true);
->setSharedBy('initiatorUID')
->setNode($file)
->setNote($note)
- ->setTarget('/file1.txt');
+ ->setTarget("/$filename");
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true);
$this->session->method('get')->with('public_link_authenticated')->willReturn('42');
$this->urlGenerator->expects($this->at(0))
->method('linkToRouteAbsolute')
- ->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token'])
+ ->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename])
->willReturn('downloadURL');
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true);
$response = $this->shareController->showShare();
$sharedTmplParams = [
'owner' => '',
- 'filename' => 'file1.txt',
- 'directory_path' => '/file1.txt',
+ 'filename' => $filename,
+ 'directory_path' => "/$filename",
'mimetype' => 'text/plain',
'dirToken' => 'token',
'sharingToken' => 'token',
public function testShowShareHideDownload() {
$note = 'personal note';
+ $filename = 'file1.txt';
$this->shareController->setToken('token');
$initiator->method('isEnabled')->willReturn(true);
$file = $this->getMockBuilder('OCP\Files\File')->getMock();
- $file->method('getName')->willReturn('file1.txt');
+ $file->method('getName')->willReturn($filename);
$file->method('getMimetype')->willReturn('text/plain');
$file->method('getSize')->willReturn(33);
$file->method('isReadable')->willReturn(true);
->setSharedBy('initiatorUID')
->setNode($file)
->setNote($note)
- ->setTarget('/file1.txt')
+ ->setTarget("/$filename")
->setHideDownload(true);
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true);
// files.
$this->urlGenerator->expects($this->at(0))
->method('linkToRouteAbsolute')
- ->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token'])
+ ->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename])
->willReturn('downloadURL');
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true);
$response = $this->shareController->showShare();
$sharedTmplParams = [
'owner' => 'ownerUID',
- 'filename' => 'file1.txt',
- 'directory_path' => '/file1.txt',
+ 'filename' => $filename,
+ 'directory_path' => "/$filename",
'mimetype' => 'text/plain',
'dirToken' => 'token',
'sharingToken' => 'token',
public function testShowShareInvalid() {
$this->expectException(\OCP\Files\NotFoundException::class);
+ $filename = 'file1.txt';
$this->shareController->setToken('token');
$owner = $this->getMockBuilder(IUser::class)->getMock();
$owner->method('getUID')->willReturn('ownerUID');
$file = $this->getMockBuilder('OCP\Files\File')->getMock();
- $file->method('getName')->willReturn('file1.txt');
+ $file->method('getName')->willReturn($filename);
$file->method('getMimetype')->willReturn('text/plain');
$file->method('getSize')->willReturn(33);
$file->method('isShareable')->willReturn(false);
$share->setPassword('password')
->setShareOwner('ownerUID')
->setNode($file)
- ->setTarget('/file1.txt');
+ ->setTarget("/$filename");
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true);
$this->session->method('get')->with('public_link_authenticated')->willReturn('42');