Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sabre-DAV to 1.8.9 #6723

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated from 95ab25 to cfb9ec
6 changes: 3 additions & 3 deletions apps/files/appinfo/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

// Load plugins
$defaults = new OC_Defaults();
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, $defaults->getName()));
$server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
$server->addPlugin(new \Sabre\DAV\Auth_Plugin($authBackend, $defaults->getName()));
$server->addPlugin(new \Sabre\DAV\Locks_Plugin($lockBackend));
$server->addPlugin(new \Sabre\DAV\Browser_Plugin(false)); // Show something in the Browser, but no upload
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
$server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin());
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin());
Expand Down
8 changes: 4 additions & 4 deletions apps/files_encryption/tests/webdav.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ function handleWebdavRequest($body = false) {
$publicDir = new OC_Connector_Sabre_Directory('');

// Fire up server
$server = new Sabre_DAV_Server($publicDir);
$server = new \Sabre\DAV\Server($publicDir);
$server->httpRequest = $requestBackend;
$server->setBaseUri('/remote.php/webdav/');

// Load plugins
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, 'ownCloud'));
$server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud'));
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false)); // Show something in the Browser, but no upload
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin());
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());

Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/webdav.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DAV extends \OC\Files\Storage\Common{
private $root;
private $ready;
/**
* @var \Sabre_DAV_Client
* @var \Sabre\DAV\Client
*/
private $client;

Expand Down Expand Up @@ -64,7 +64,7 @@ private function init(){
'password' => $this->password,
);

$this->client = new \Sabre_DAV_Client($settings);
$this->client = new \Sabre\DAV\Client($settings);

$caview = \OCP\Files::getStorage('files_external');
if ($caview) {
Expand Down
1 change: 1 addition & 0 deletions apps/files_sharing/lib/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public static function updateShare($params) {
return self::updatePublicUpload($share, $params);
}
} catch (\Exception $e) {

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case this wasn't clear: Remove the pointless change from the diff?

return new \OC_OCS_Result(null, 400, $e->getMessage());
}

Expand Down
22 changes: 0 additions & 22 deletions lib/private/connector/sabre/ServiceUnavailable.php

This file was deleted.

18 changes: 9 additions & 9 deletions lib/private/connector/sabre/aborteduploaddetectionplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
* This plugin will verify if the uploaded data has been stored completely.
* This is done by comparing the content length of the request with the file size on storage.
*/
class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPlugin {
class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends \Sabre\DAV\ServerPlugin {

/**
* Reference to main server object
*
* @var Sabre_DAV_Server
* @var \Sabre\DAV\Server
*/
private $server;

Expand All @@ -31,14 +31,14 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
/**
* This initializes the plugin.
*
* This function is called by Sabre_DAV_Server, after
* This function is called by \Sabre\DAV\Server, after
* addPlugin is called.
*
* This method should set up the requires event subscriptions.
*
* @param Sabre_DAV_Server $server
* @param \Sabre\DAV\Server $server
*/
public function initialize(Sabre_DAV_Server $server) {
public function initialize(\Sabre\DAV\Server $server) {

$this->server = $server;

Expand All @@ -48,10 +48,10 @@ public function initialize(Sabre_DAV_Server $server) {

/**
* @param $filePath
* @param Sabre_DAV_INode $node
* @throws Sabre_DAV_Exception_BadRequest
* @param \Sabre\DAV\INode $node
* @throws \Sabre\DAV\Exception\BadRequest
*/
public function verifyContentLength($filePath, Sabre_DAV_INode $node = null) {
public function verifyContentLength($filePath, \Sabre\DAV\INode $node = null) {

// we should only react on PUT which is used for upload
// e.g. with LOCK this will not work, but LOCK uses createFile() as well
Expand All @@ -73,7 +73,7 @@ public function verifyContentLength($filePath, Sabre_DAV_INode $node = null) {
$actual = $this->getFileView()->filesize($filePath);
if ($actual != $expected) {
$this->getFileView()->unlink($filePath);
throw new Sabre_DAV_Exception_BadRequest('expected filesize ' . $expected . ' got ' . $actual);
throw new \Sabre\DAV\Exception\BadRequest('expected filesize ' . $expected . ' got ' . $actual);
}

}
Expand Down
4 changes: 2 additions & 2 deletions lib/private/connector/sabre/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
class OC_Connector_Sabre_Auth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
/**
* Validates a username and password
*
Expand Down Expand Up @@ -71,7 +71,7 @@ public function getCurrentUser() {
*
* @return bool
*/
public function authenticate(Sabre_DAV_Server $server, $realm) {
public function authenticate(\Sabre\DAV\Server $server, $realm) {

if (OC_User::handleApacheAuth() || OC_User::isLoggedIn()) {
$user = OC_User::getUser();
Expand Down
35 changes: 18 additions & 17 deletions lib/private/connector/sabre/directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
*
*/

class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sabre_DAV_ICollection, Sabre_DAV_IQuota {
class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node
implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota {

/**
* Creates a new file in the directory
*
* Data will either be supplied as a stream resource, or in certain cases
* as a string. Keep in mind that you may have to support either.
*
* After succesful creation of the file, you may choose to return the ETag
* After successful creation of the file, you may choose to return the ETag
* of the new file here.
*
* The returned ETag must be surrounded by double-quotes (The quotes should
Expand All @@ -45,13 +46,13 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*
* @param string $name Name of the file
* @param resource|string $data Initial payload
* @throws Sabre_DAV_Exception_Forbidden
* @throws \Sabre\DAV\Exception\Forbidden
* @return null|string
*/
public function createFile($name, $data = null) {

if ($name === 'Shared' && empty($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
throw new \Sabre\DAV\Exception\Forbidden();
}

// for chunked upload also updating a existing file is a "createFile"
Expand All @@ -62,13 +63,13 @@ public function createFile($name, $data = null) {
$info = OC_FileChunking::decodeName($name);
if (!\OC\Files\Filesystem::isCreatable($this->path) &&
!\OC\Files\Filesystem::isUpdatable($this->path . '/' . $info['name'])) {
throw new \Sabre_DAV_Exception_Forbidden();
throw new \Sabre\DAV\Exception\Forbidden();
}

} else {
// For non-chunked upload it is enough to check if we can create a new file
if (!\OC\Files\Filesystem::isCreatable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
throw new \Sabre\DAV\Exception\Forbidden();
}
}

Expand All @@ -81,22 +82,22 @@ public function createFile($name, $data = null) {
* Creates a new subdirectory
*
* @param string $name
* @throws Sabre_DAV_Exception_Forbidden
* @throws \Sabre\DAV\Exception\Forbidden
* @return void
*/
public function createDirectory($name) {

if ($name === 'Shared' && empty($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
throw new \Sabre\DAV\Exception\Forbidden();
}

if (!\OC\Files\Filesystem::isCreatable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
throw new \Sabre\DAV\Exception\Forbidden();
}

$newPath = $this->path . '/' . $name;
if(!\OC\Files\Filesystem::mkdir($newPath)) {
throw new Sabre_DAV_Exception_Forbidden('Could not create directory '.$newPath);
throw new \Sabre\DAV\Exception\Forbidden('Could not create directory '.$newPath);
}

}
Expand All @@ -105,8 +106,8 @@ public function createDirectory($name) {
* Returns a specific child node, referenced by its name
*
* @param string $name
* @throws Sabre_DAV_Exception_FileNotFound
* @return Sabre_DAV_INode
* @throws \Sabre\DAV\Exception\FileNotFound
* @return \Sabre\DAV\INode
*/
public function getChild($name, $info = null) {

Expand All @@ -116,7 +117,7 @@ public function getChild($name, $info = null) {
}

if (!$info) {
throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
}

if ($info['mimetype'] == 'httpd/unix-directory') {
Expand All @@ -132,7 +133,7 @@ public function getChild($name, $info = null) {
/**
* Returns an array with all the child nodes
*
* @return Sabre_DAV_INode[]
* @return \Sabre\DAV\INode[]
*/
public function getChildren() {

Expand Down Expand Up @@ -191,16 +192,16 @@ public function childExists($name) {
* Deletes all files in this directory, and then itself
*
* @return void
* @throws Sabre_DAV_Exception_Forbidden
* @throws \Sabre\DAV\Exception\Forbidden
*/
public function delete() {

if ($this->path === 'Shared') {
throw new \Sabre_DAV_Exception_Forbidden();
throw new \Sabre\DAV\Exception\Forbidden();
}

if (!\OC\Files\Filesystem::isDeletable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
throw new \Sabre\DAV\Exception\Forbidden();
}

\OC\Files\Filesystem::rmdir($this->path);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/connector/sabre/exception/entitytoolarge.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* This exception is thrown whenever a user tries to upload a file which exceeds hard limitations
*
*/
class OC_Connector_Sabre_Exception_EntityTooLarge extends Sabre_DAV_Exception {
class OC_Connector_Sabre_Exception_EntityTooLarge extends \Sabre\DAV\Exception {

/**
* Returns the HTTP status code for this exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* This exception is thrown whenever a user tries to upload a file which holds content which is not allowed
*
*/
class OC_Connector_Sabre_Exception_UnsupportedMediaType extends Sabre_DAV_Exception {
class OC_Connector_Sabre_Exception_UnsupportedMediaType extends \Sabre\DAV\Exception {

/**
* Returns the HTTP status code for this exception
Expand Down
Loading