Steps to reproduce
Create a public Nextcloud share link for a single PDF file (not folder).
Access the public DAV endpoint (e.g. viewer or HEAD request on /public.php/dav/files/<token>).
Observe slow load and server log TypeError.
CorePlugin::httpGet() sets $body = '' for HEAD but does not convert it to a stream. Later, range handling calls stream_get_meta_data($body) which fails on string bodies. This breaks range support used by PDF viewers, causing very slow loads.
This issue relates to nextcloud/3rdparty#2241
Pull request in Nextcloud nextcloud/3rdparty#2241 with proposed fix to initialize $body = fopen('php://temp', 'r+');
public function httpGet(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
$node = $this->server->tree->getNodeForPath($path);
if (!$node instanceof IFile) {
return;
}
if ('HEAD' === $request->getHeader('X-Sabre-Original-Method')) {
$body = fopen('php://temp', 'r+');
} else {
$body = $node->get();