Skip to content
Snippets Groups Projects
Commit c6a83b2f authored by Robin Appelman's avatar Robin Appelman Committed by Bjoern Schiessle
Browse files

Fix exposing single files over webdav

parent cf5a72c1
No related branches found
No related tags found
No related merge requests found
......@@ -47,8 +47,12 @@ $server->subscribeEvent('beforeMethod', function () use ($server, $objectTree, $
$rootInfo = $view->getFileInfo('');
// Create ownCloud Dir
$rootDir = new OC_Connector_Sabre_Directory($view, $rootInfo);
$objectTree->init($rootDir, $view);
if ($rootInfo->getType() === 'dir') {
$root = new OC_Connector_Sabre_Directory($view, $rootInfo);
} else {
$root = new OC_Connector_Sabre_File($view, $rootInfo);
}
$objectTree->init($root, $view);
$server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin($view));
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view));
......
......@@ -140,7 +140,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
if (\OC_Util::encryptedFiles()) {
throw new \Sabre\DAV\Exception\ServiceUnavailable();
} else {
return $this->fileView->fopen($this->path, 'rb');
return $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment