aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2025-02-17 12:04:18 +0100
committerLouis Chemineau <louis@chmn.me>2025-02-17 12:04:18 +0100
commitadaac8c880d97d0f000871404440bb8befa198ea (patch)
treed52f0d5d3af06e0b65a65d1ae5db7a6f682e5d84
parentc71bc0696f33c1cf30d8197864b0ab454f2c10df (diff)
downloadnextcloud-server-artonge/feat/allow_deleting_metadata.tar.gz
nextcloud-server-artonge/feat/allow_deleting_metadata.zip
feat: Support deleting metadata from WebDAVartonge/feat/allow_deleting_metadata
The `$value` will be `null` if the update is wrapped inside a `<d:remove>...</d:remove>` block. Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index a879e264459..65379195479 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -598,6 +598,12 @@ class FilesPlugin extends ServerPlugin {
throw new FilesMetadataException('you do not have enough rights to update \'' . $metadataKey . '\' on this node');
}
+ if ($value === null) {
+ $metadata->unset($metadataKey);
+ $filesMetadataManager->saveMetadata($metadata);
+ return true;
+ }
+
// If the metadata is unknown, it defaults to string.
try {
$type = $knownMetadata->getType($metadataKey);