mirror of https://github.com/nextcloud/contacts
Merge pull request #2765 from nextcloud/bug/2366/add-encoding-for-header
Encode group names for x-property-replace header
This commit is contained in:
commit
d59d6f4eab
|
@ -28,8 +28,6 @@ namespace OCA\Contacts\Dav;
|
|||
|
||||
use Sabre\CardDAV\Card;
|
||||
use Sabre\DAV;
|
||||
use Sabre\DAV\INode;
|
||||
use Sabre\DAV\PropPatch;
|
||||
use Sabre\DAV\Server;
|
||||
use Sabre\DAV\ServerPlugin;
|
||||
use Sabre\HTTP\RequestInterface;
|
||||
|
@ -85,9 +83,13 @@ class PatchPlugin extends ServerPlugin {
|
|||
/**
|
||||
* Adds all CardDAV-specific properties
|
||||
*
|
||||
* @param PropPatch $propPatch
|
||||
* @param INode $node
|
||||
* @param RequestInterface $request
|
||||
* @param ResponseInterface $response
|
||||
* @return bool
|
||||
* @throws DAV\Exception\BadRequest
|
||||
* @throws DAV\Exception\NotAuthenticated
|
||||
* @throws DAV\Exception\NotFound
|
||||
* @throws \Sabre\DAVACL\Exception\NeedPrivileges
|
||||
*/
|
||||
public function httpPatch(RequestInterface $request, ResponseInterface $response): bool {
|
||||
$path = $request->getPath();
|
||||
|
@ -119,6 +121,8 @@ class PatchPlugin extends ServerPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
$propertyData = rawurldecode($propertyData);
|
||||
|
||||
// Init contact
|
||||
$vCard = Reader::read($node->get());
|
||||
$properties = $vCard->select($propertyName);
|
||||
|
|
|
@ -34,7 +34,7 @@ const appendContactToGroup = async function(contact, groupName) {
|
|||
return axios.patch(contact.url, {}, {
|
||||
headers: {
|
||||
'X-PROPERTY': 'CATEGORIES',
|
||||
'X-PROPERTY-REPLACE': groups.join(','),
|
||||
'X-PROPERTY-REPLACE': groups.map(groupName => encodeURIComponent(groupName)).join(','),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue