[Pkg-owncloud-commits] [owncloud] 107/223: Fix exposing single files over webdav
David Prévot
taffit at moszumanska.debian.org
Sun Jun 22 01:54:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit c6a83b2f1740936ba39acc13b6f0f9b9d619ca07
Author: Robin Appelman <icewind at owncloud.com>
Date: Wed May 14 23:08:45 2014 +0200
Fix exposing single files over webdav
---
apps/files_sharing/publicwebdav.php | 8 ++++++--
lib/private/connector/sabre/file.php | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/apps/files_sharing/publicwebdav.php b/apps/files_sharing/publicwebdav.php
index df2c04c..b4f56ee 100644
--- a/apps/files_sharing/publicwebdav.php
+++ b/apps/files_sharing/publicwebdav.php
@@ -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));
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index 4e90d46..7591cc5 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -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');
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list