server = $server; $server->on('afterMethod:PUT', $this->afterPut(...)); } private function afterPut(RequestInterface $request, ResponseInterface $response): void { if ($this->server === null) { return; } $node = null; try { $node = $this->server->tree->getNodeForPath($request->getPath()); } catch (NotFound) { $this->logger->error("Cannot set extra headers for non-existing file '{$request->getPath()}'"); return; } if (!$node instanceof Node) { $nodeType = get_debug_type($node); $this->logger->error("Cannot set extra headers for node of type {$nodeType} for file '{$request->getPath()}'"); return; } if (!$this->isPublic) { $ownerId = $node->getOwner()?->getUID(); if ($ownerId !== null) { $response->setHeader('X-NC-OwnerId', $ownerId); } } $permissions = $this->isPublic ? $node->getPublicDavPermissions() : $node->getDavPermissions(); $response->setHeader('X-NC-Permissions', $permissions); } }