summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-11-08 10:03:25 +0100
committerLukas Reschke <lukas@statuscode.ch>2016-12-19 15:53:13 +0100
commit04cf77120cec24d011dccca9aaf312762b13678f (patch)
tree1ee9df12336d7383a557e8caf7a08960e5afb356
parent6345748a70d8a44cdc3aa15c078da4ea0c512c10 (diff)
downloadnextcloud-server-04cf77120cec24d011dccca9aaf312762b13678f.tar.gz
nextcloud-server-04cf77120cec24d011dccca9aaf312762b13678f.zip
Fix error when $view is null when being passed into some plugins
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesReportPlugin.php12
-rw-r--r--apps/dav/lib/Server.php39
2 files changed, 27 insertions, 24 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
index bc0c1c2f603..81c082b9105 100644
--- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
@@ -24,9 +24,7 @@
namespace OCA\DAV\Connector\Sabre;
use OC\Files\View;
-use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Exception\PreconditionFailed;
-use Sabre\DAV\Exception\ReportNotSupported;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\ServerPlugin;
use Sabre\DAV\Tree;
@@ -105,7 +103,7 @@ class FilesReportPlugin extends ServerPlugin {
* @param ITagManager $fileTagger manager for private tags
* @param IUserSession $userSession
* @param IGroupManager $groupManager
- * @param Folder $userfolder
+ * @param Folder $userFolder
*/
public function __construct(Tree $tree,
View $view,
@@ -161,11 +159,12 @@ class FilesReportPlugin extends ServerPlugin {
* REPORT operations to look for files
*
* @param string $reportName
- * @param [] $report
+ * @param $report
* @param string $uri
* @return bool
- * @throws NotFound
- * @throws ReportNotSupported
+ * @throws BadRequest
+ * @throws PreconditionFailed
+ * @internal param $ [] $report
*/
public function onReport($reportName, $report, $uri) {
$reportTargetNode = $this->server->tree->getNodeForPath($uri);
@@ -232,7 +231,6 @@ class FilesReportPlugin extends ServerPlugin {
private function getFilesBaseUri($uri, $subPath) {
$uri = trim($uri, '/');
$subPath = trim($subPath, '/');
- $filesUri = '';
if (empty($subPath)) {
$filesUri = $uri;
} else {
diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php
index 77002682fa6..79c4301a8d8 100644
--- a/apps/dav/lib/Server.php
+++ b/apps/dav/lib/Server.php
@@ -33,11 +33,14 @@ use OCA\DAV\CardDAV\ImageExportPlugin;
use OCA\DAV\Comments\CommentsPlugin;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
+use OCA\DAV\Connector\Sabre\CommentPropertiesPlugin;
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
use OCA\DAV\Connector\Sabre\DavAclPlugin;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
use OCA\DAV\Connector\Sabre\FilesPlugin;
+use OCA\DAV\Connector\Sabre\FilesReportPlugin;
+use OCA\DAV\Connector\Sabre\SharesPlugin;
use OCA\DAV\DAV\PublicAuth;
use OCA\DAV\Connector\Sabre\QuotaPlugin;
use OCA\DAV\Files\BrowserErrorPagePlugin;
@@ -165,7 +168,7 @@ class Server {
// custom properties plugin must be the last one
$userSession = \OC::$server->getUserSession();
$user = $userSession->getUser();
- if (!is_null($user)) {
+ if ($user !== null) {
$view = \OC\Files\Filesystem::getView();
$this->server->addPlugin(
new FilesPlugin(
@@ -187,9 +190,10 @@ class Server {
)
)
);
- $this->server->addPlugin(
- new QuotaPlugin($view)
- );
+ if ($view !== null) {
+ $this->server->addPlugin(
+ new QuotaPlugin($view));
+ }
$this->server->addPlugin(
new TagsPlugin(
$this->server->tree, \OC::$server->getTagManager()
@@ -197,28 +201,29 @@ class Server {
);
// TODO: switch to LazyUserFolder
$userFolder = \OC::$server->getUserFolder();
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
+ $this->server->addPlugin(new SharesPlugin(
$this->server->tree,
$userSession,
$userFolder,
\OC::$server->getShareManager()
));
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(
+ $this->server->addPlugin(new CommentPropertiesPlugin(
\OC::$server->getCommentsManager(),
$userSession
));
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
- $this->server->tree,
- $view,
- \OC::$server->getSystemTagManager(),
- \OC::$server->getSystemTagObjectMapper(),
- \OC::$server->getTagManager(),
- $userSession,
- \OC::$server->getGroupManager(),
- $userFolder
- ));
+ if ($view !== null) {
+ $this->server->addPlugin(new FilesReportPlugin(
+ $this->server->tree,
+ $view,
+ \OC::$server->getSystemTagManager(),
+ \OC::$server->getSystemTagObjectMapper(),
+ \OC::$server->getTagManager(),
+ $userSession,
+ \OC::$server->getGroupManager(),
+ $userFolder
+ ));
+ }
}
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
});
}