Fix error when $view is null when being passed into some plugins
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
6345748a70
commit
04cf77120c
|
@ -24,9 +24,7 @@
|
||||||
namespace OCA\DAV\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OC\Files\View;
|
use OC\Files\View;
|
||||||
use Sabre\DAV\Exception\NotFound;
|
|
||||||
use Sabre\DAV\Exception\PreconditionFailed;
|
use Sabre\DAV\Exception\PreconditionFailed;
|
||||||
use Sabre\DAV\Exception\ReportNotSupported;
|
|
||||||
use Sabre\DAV\Exception\BadRequest;
|
use Sabre\DAV\Exception\BadRequest;
|
||||||
use Sabre\DAV\ServerPlugin;
|
use Sabre\DAV\ServerPlugin;
|
||||||
use Sabre\DAV\Tree;
|
use Sabre\DAV\Tree;
|
||||||
|
@ -105,7 +103,7 @@ class FilesReportPlugin extends ServerPlugin {
|
||||||
* @param ITagManager $fileTagger manager for private tags
|
* @param ITagManager $fileTagger manager for private tags
|
||||||
* @param IUserSession $userSession
|
* @param IUserSession $userSession
|
||||||
* @param IGroupManager $groupManager
|
* @param IGroupManager $groupManager
|
||||||
* @param Folder $userfolder
|
* @param Folder $userFolder
|
||||||
*/
|
*/
|
||||||
public function __construct(Tree $tree,
|
public function __construct(Tree $tree,
|
||||||
View $view,
|
View $view,
|
||||||
|
@ -161,11 +159,12 @@ class FilesReportPlugin extends ServerPlugin {
|
||||||
* REPORT operations to look for files
|
* REPORT operations to look for files
|
||||||
*
|
*
|
||||||
* @param string $reportName
|
* @param string $reportName
|
||||||
* @param [] $report
|
* @param $report
|
||||||
* @param string $uri
|
* @param string $uri
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws NotFound
|
* @throws BadRequest
|
||||||
* @throws ReportNotSupported
|
* @throws PreconditionFailed
|
||||||
|
* @internal param $ [] $report
|
||||||
*/
|
*/
|
||||||
public function onReport($reportName, $report, $uri) {
|
public function onReport($reportName, $report, $uri) {
|
||||||
$reportTargetNode = $this->server->tree->getNodeForPath($uri);
|
$reportTargetNode = $this->server->tree->getNodeForPath($uri);
|
||||||
|
@ -232,7 +231,6 @@ class FilesReportPlugin extends ServerPlugin {
|
||||||
private function getFilesBaseUri($uri, $subPath) {
|
private function getFilesBaseUri($uri, $subPath) {
|
||||||
$uri = trim($uri, '/');
|
$uri = trim($uri, '/');
|
||||||
$subPath = trim($subPath, '/');
|
$subPath = trim($subPath, '/');
|
||||||
$filesUri = '';
|
|
||||||
if (empty($subPath)) {
|
if (empty($subPath)) {
|
||||||
$filesUri = $uri;
|
$filesUri = $uri;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,11 +33,14 @@ use OCA\DAV\CardDAV\ImageExportPlugin;
|
||||||
use OCA\DAV\Comments\CommentsPlugin;
|
use OCA\DAV\Comments\CommentsPlugin;
|
||||||
use OCA\DAV\Connector\Sabre\Auth;
|
use OCA\DAV\Connector\Sabre\Auth;
|
||||||
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
||||||
|
use OCA\DAV\Connector\Sabre\CommentPropertiesPlugin;
|
||||||
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
|
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
|
||||||
use OCA\DAV\Connector\Sabre\DavAclPlugin;
|
use OCA\DAV\Connector\Sabre\DavAclPlugin;
|
||||||
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
|
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
|
||||||
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
|
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
|
||||||
use OCA\DAV\Connector\Sabre\FilesPlugin;
|
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\DAV\PublicAuth;
|
||||||
use OCA\DAV\Connector\Sabre\QuotaPlugin;
|
use OCA\DAV\Connector\Sabre\QuotaPlugin;
|
||||||
use OCA\DAV\Files\BrowserErrorPagePlugin;
|
use OCA\DAV\Files\BrowserErrorPagePlugin;
|
||||||
|
@ -165,7 +168,7 @@ class Server {
|
||||||
// custom properties plugin must be the last one
|
// custom properties plugin must be the last one
|
||||||
$userSession = \OC::$server->getUserSession();
|
$userSession = \OC::$server->getUserSession();
|
||||||
$user = $userSession->getUser();
|
$user = $userSession->getUser();
|
||||||
if (!is_null($user)) {
|
if ($user !== null) {
|
||||||
$view = \OC\Files\Filesystem::getView();
|
$view = \OC\Files\Filesystem::getView();
|
||||||
$this->server->addPlugin(
|
$this->server->addPlugin(
|
||||||
new FilesPlugin(
|
new FilesPlugin(
|
||||||
|
@ -187,9 +190,10 @@ class Server {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->server->addPlugin(
|
if ($view !== null) {
|
||||||
new QuotaPlugin($view)
|
$this->server->addPlugin(
|
||||||
);
|
new QuotaPlugin($view));
|
||||||
|
}
|
||||||
$this->server->addPlugin(
|
$this->server->addPlugin(
|
||||||
new TagsPlugin(
|
new TagsPlugin(
|
||||||
$this->server->tree, \OC::$server->getTagManager()
|
$this->server->tree, \OC::$server->getTagManager()
|
||||||
|
@ -197,28 +201,29 @@ class Server {
|
||||||
);
|
);
|
||||||
// TODO: switch to LazyUserFolder
|
// TODO: switch to LazyUserFolder
|
||||||
$userFolder = \OC::$server->getUserFolder();
|
$userFolder = \OC::$server->getUserFolder();
|
||||||
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
|
$this->server->addPlugin(new SharesPlugin(
|
||||||
$this->server->tree,
|
$this->server->tree,
|
||||||
$userSession,
|
$userSession,
|
||||||
$userFolder,
|
$userFolder,
|
||||||
\OC::$server->getShareManager()
|
\OC::$server->getShareManager()
|
||||||
));
|
));
|
||||||
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(
|
$this->server->addPlugin(new CommentPropertiesPlugin(
|
||||||
\OC::$server->getCommentsManager(),
|
\OC::$server->getCommentsManager(),
|
||||||
$userSession
|
$userSession
|
||||||
));
|
));
|
||||||
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
|
if ($view !== null) {
|
||||||
$this->server->tree,
|
$this->server->addPlugin(new FilesReportPlugin(
|
||||||
$view,
|
$this->server->tree,
|
||||||
\OC::$server->getSystemTagManager(),
|
$view,
|
||||||
\OC::$server->getSystemTagObjectMapper(),
|
\OC::$server->getSystemTagManager(),
|
||||||
\OC::$server->getTagManager(),
|
\OC::$server->getSystemTagObjectMapper(),
|
||||||
$userSession,
|
\OC::$server->getTagManager(),
|
||||||
\OC::$server->getGroupManager(),
|
$userSession,
|
||||||
$userFolder
|
\OC::$server->getGroupManager(),
|
||||||
));
|
$userFolder
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue