summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna <anna@nextcloud.com>2022-07-19 10:26:45 +0200
committerGitHub <noreply@github.com>2022-07-19 10:26:45 +0200
commit1d82cd8f3007a57dcc5cc76a273e4212f0221fc7 (patch)
treeb3f912ca374d1d37d366674f4e6a535973f5e5b1
parent75e3b331ceba82efe777969d6a9ec83ce0a11200 (diff)
parent4edaee555a70ffb905a747db54c33a25aae3a035 (diff)
Merge pull request #2853 from nextcloud/backport/2765/stable4.1stable4.1
[stable4.1] Encode group names for x-property-replace header
-rw-r--r--lib/Dav/PatchPlugin.php12
-rw-r--r--src/services/appendContactToGroup.js2
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/Dav/PatchPlugin.php b/lib/Dav/PatchPlugin.php
index 9f4f9d1f..e051ec92 100644
--- a/lib/Dav/PatchPlugin.php
+++ b/lib/Dav/PatchPlugin.php
@@ -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);
diff --git a/src/services/appendContactToGroup.js b/src/services/appendContactToGroup.js
index 6e520426..cfdd5567 100644
--- a/src/services/appendContactToGroup.js
+++ b/src/services/appendContactToGroup.js
@@ -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(','),
},
})
}