Properly respect hide download on sharebymail
fixes #19484 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
dbead0c0fa
commit
84a148aac1
|
@ -354,7 +354,8 @@ class ShareByMailProvider implements IShareProvider {
|
|||
$share->getPermissions(),
|
||||
$share->getToken(),
|
||||
$share->getPassword(),
|
||||
$share->getSendPasswordByTalk()
|
||||
$share->getSendPasswordByTalk(),
|
||||
$share->getHideDownload()
|
||||
);
|
||||
|
||||
try {
|
||||
|
@ -686,9 +687,10 @@ class ShareByMailProvider implements IShareProvider {
|
|||
* @param string $token
|
||||
* @param string $password
|
||||
* @param bool $sendPasswordByTalk
|
||||
* @param bool $hideDownload
|
||||
* @return int
|
||||
*/
|
||||
protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk) {
|
||||
protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload) {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->insert('share')
|
||||
->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL))
|
||||
|
@ -702,7 +704,8 @@ class ShareByMailProvider implements IShareProvider {
|
|||
->setValue('token', $qb->createNamedParameter($token))
|
||||
->setValue('password', $qb->createNamedParameter($password))
|
||||
->setValue('password_by_talk', $qb->createNamedParameter($sendPasswordByTalk, IQueryBuilder::PARAM_BOOL))
|
||||
->setValue('stime', $qb->createNamedParameter(time()));
|
||||
->setValue('stime', $qb->createNamedParameter(time()))
|
||||
->setValue('hide_download', $qb->createNamedParameter($hideDownload, IQueryBuilder::PARAM_BOOL));
|
||||
|
||||
/*
|
||||
* Added to fix https://github.com/owncloud/core/issues/22215
|
||||
|
@ -747,6 +750,7 @@ class ShareByMailProvider implements IShareProvider {
|
|||
->set('password_by_talk', $qb->createNamedParameter($share->getSendPasswordByTalk(), IQueryBuilder::PARAM_BOOL))
|
||||
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
||||
->set('note', $qb->createNamedParameter($share->getNote()))
|
||||
->set('hide_download', $qb->createNamedParameter($share->getHideDownload(), IQueryBuilder::PARAM_BOOL))
|
||||
->execute();
|
||||
|
||||
if ($originalShare->getNote() !== $share->getNote() && $share->getNote() !== '') {
|
||||
|
@ -1007,6 +1011,7 @@ class ShareByMailProvider implements IShareProvider {
|
|||
$share->setSharedWith($data['share_with']);
|
||||
$share->setPassword($data['password']);
|
||||
$share->setSendPasswordByTalk((bool)$data['password_by_talk']);
|
||||
$share->setHideDownload((bool)$data['hide_download']);
|
||||
|
||||
if ($data['uid_initiator'] !== null) {
|
||||
$share->setShareOwner($data['uid_owner']);
|
||||
|
|
|
@ -313,7 +313,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testCreateFailed() {
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
|
@ -356,7 +356,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testCreateMailShareFailed() {
|
||||
$this->expectException(\OC\HintException::class);
|
||||
|
||||
|
@ -406,6 +406,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$token = 'token';
|
||||
$password = 'password';
|
||||
$sendPasswordByTalk = true;
|
||||
$hideDownload = true;
|
||||
|
||||
|
||||
$instance = $this->getInstance();
|
||||
|
@ -421,7 +422,8 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$permissions,
|
||||
$token,
|
||||
$password,
|
||||
$sendPasswordByTalk
|
||||
$sendPasswordByTalk,
|
||||
$hideDownload
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -442,6 +444,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$this->assertSame($token, $result[0]['token']);
|
||||
$this->assertSame($password, $result[0]['password']);
|
||||
$this->assertSame($sendPasswordByTalk, (bool)$result[0]['password_by_talk']);
|
||||
$this->assertSame($hideDownload, (bool)$result[0]['hide_download']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -580,7 +583,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$this->assertInstanceOf('OCP\Share\IShare', $result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetShareByIdFailed() {
|
||||
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
|
||||
|
||||
|
@ -665,7 +668,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$this->assertInstanceOf('OCP\Share\IShare', $result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetShareByTokenFailed() {
|
||||
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
|
||||
|
||||
|
@ -782,7 +785,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$this->assertSame($token, $result['token']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetRawShareFailed() {
|
||||
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
|
||||
|
||||
|
|
Loading…
Reference in New Issue