mirror of
https://github.com/nextcloud/server.git
synced 2026-04-29 01:50:33 -04:00
Add "password" parameter to the response data of link shares
Due to legacy reasons the password of link shares was returned in the "share_with" and "share_with_displayname" parameters of the response data. Now a proper "password" parameter is returned too; the old "share_with" and "share_with_displayname" parameters are kept, although deprecated, and they will be removed in a future version of Nextcloud. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
85d2c7ec38
commit
b2cc2d6023
2 changed files with 7 additions and 0 deletions
|
|
@ -208,9 +208,13 @@ class ShareAPIController extends OCSController {
|
|||
$result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith();
|
||||
} else if ($share->getShareType() === Share::SHARE_TYPE_LINK) {
|
||||
|
||||
// "share_with" and "share_with_displayname" for passwords of link
|
||||
// shares was deprecated in Nextcloud 15, use "password" instead.
|
||||
$result['share_with'] = $share->getPassword();
|
||||
$result['share_with_displayname'] = $share->getPassword();
|
||||
|
||||
$result['password'] = $share->getPassword();
|
||||
|
||||
$result['send_password_by_talk'] = $share->getSendPasswordByTalk();
|
||||
|
||||
$result['token'] = $share->getToken();
|
||||
|
|
|
|||
|
|
@ -428,6 +428,7 @@ class ShareAPIControllerTest extends TestCase {
|
|||
$expected = [
|
||||
'id' => 101,
|
||||
'share_type' => \OCP\Share::SHARE_TYPE_LINK,
|
||||
'password' => 'password',
|
||||
'share_with' => 'password',
|
||||
'share_with_displayname' => 'password',
|
||||
'send_password_by_talk' => false,
|
||||
|
|
@ -2687,6 +2688,7 @@ class ShareAPIControllerTest extends TestCase {
|
|||
'file_source' => 3,
|
||||
'file_parent' => 1,
|
||||
'file_target' => 'myTarget',
|
||||
'password' => 'mypassword',
|
||||
'share_with' => 'mypassword',
|
||||
'share_with_displayname' => 'mypassword',
|
||||
'send_password_by_talk' => false,
|
||||
|
|
@ -2736,6 +2738,7 @@ class ShareAPIControllerTest extends TestCase {
|
|||
'file_source' => 3,
|
||||
'file_parent' => 1,
|
||||
'file_target' => 'myTarget',
|
||||
'password' => 'mypassword',
|
||||
'share_with' => 'mypassword',
|
||||
'share_with_displayname' => 'mypassword',
|
||||
'send_password_by_talk' => true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue