Browse Source

[DAV] Fix URLUtil::splitPath usage

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
tags/v13.0.0beta1
Roeland Jago Douma 6 years ago
parent
commit
fc369dd86e
No account linked to committer's email address

+ 1
- 1
apps/dav/lib/CalDAV/Plugin.php View File

@@ -31,7 +31,7 @@ class Plugin extends \Sabre\CalDAV\Plugin {
function getCalendarHomeForPrincipal($principalUrl) {

if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
list(, $principalId) = URLUtil::splitPath($principalUrl);
list(, $principalId) = \Sabre\Uri\split($principalUrl);
return self::CALENDAR_ROOT .'/' . $principalId;
}


+ 2
- 2
apps/dav/lib/CardDAV/CardDavBackend.php View File

@@ -196,7 +196,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}
}

list(, $name) = URLUtil::splitPath($row['principaluri']);
list(, $name) = \Sabre\Uri\split($row['principaluri']);
$uri = $row['uri'] . '_shared_by_' . $name;
$displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';

@@ -1091,7 +1091,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {

private function convertPrincipal($principalUri, $toV2) {
if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
list(, $name) = URLUtil::splitPath($principalUri);
list(, $name) = \Sabre\Uri\split($principalUri);
if ($toV2 === true) {
return "principals/users/$name";
}

+ 3
- 3
apps/dav/lib/CardDAV/Plugin.php View File

@@ -44,15 +44,15 @@ class Plugin extends \Sabre\CardDAV\Plugin {
protected function getAddressbookHomeForPrincipal($principal) {

if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) {
list(, $principalId) = URLUtil::splitPath($principal);
list(, $principalId) = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/users/' . $principalId;
}
if (strrpos($principal, 'principals/groups', -strlen($principal)) !== false) {
list(, $principalId) = URLUtil::splitPath($principal);
list(, $principalId) = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/groups/' . $principalId;
}
if (strrpos($principal, 'principals/system', -strlen($principal)) !== false) {
list(, $principalId) = URLUtil::splitPath($principal);
list(, $principalId) = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/system/' . $principalId;
}


+ 1
- 1
apps/dav/lib/Connector/LegacyDAVACL.php View File

@@ -51,7 +51,7 @@ class LegacyDAVACL extends DavAclPlugin {
}

private function convertPrincipal($principal, $toV2) {
list(, $name) = URLUtil::splitPath($principal);
list(, $name) = \Sabre\Uri\split($principal);
if ($toV2) {
return "principals/users/$name";
}

+ 1
- 1
apps/dav/lib/Connector/Sabre/Directory.php View File

@@ -387,7 +387,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists');
}

list($sourceDir,) = \Sabre\HTTP\URLUtil::splitPath($sourceNode->getPath());
list($sourceDir,) = \Sabre\Uri\split($sourceNode->getPath());
$destinationDir = $this->getPath();

$sourcePath = $sourceNode->getPath();

+ 1
- 1
apps/dav/lib/Connector/Sabre/File.php View File

@@ -396,7 +396,7 @@ class File extends Node implements IFile {
* @throws ServiceUnavailable
*/
private function createFileChunked($data) {
list($path, $name) = \Sabre\HTTP\URLUtil::splitPath($this->path);
list($path, $name) = \Sabre\Uri\split($this->path);

$info = \OC_FileChunking::decodeName($name);
if (empty($info)) {

+ 3
- 3
apps/dav/lib/Connector/Sabre/FilesPlugin.php View File

@@ -196,8 +196,8 @@ class FilesPlugin extends ServerPlugin {
if (!$sourceNode instanceof Node) {
return;
}
list($sourceDir,) = \Sabre\HTTP\URLUtil::splitPath($source);
list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destination);
list($sourceDir,) = \Sabre\Uri\split($source);
list($destinationDir,) = \Sabre\Uri\split($destination);

if ($sourceDir !== $destinationDir) {
$sourceNodeFileInfo = $sourceNode->getFileInfo();
@@ -432,7 +432,7 @@ class FilesPlugin extends ServerPlugin {
public function sendFileIdHeader($filePath, \Sabre\DAV\INode $node = null) {
// chunked upload handling
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
list($path, $name) = \Sabre\HTTP\URLUtil::splitPath($filePath);
list($path, $name) = \Sabre\Uri\split($filePath);
$info = \OC_FileChunking::decodeName($name);
if (!empty($info)) {
$filePath = $path . '/' . $info['name'];

+ 2
- 2
apps/dav/lib/Connector/Sabre/Node.php View File

@@ -126,8 +126,8 @@ abstract class Node implements \Sabre\DAV\INode {
throw new \Sabre\DAV\Exception\Forbidden();
}

list($parentPath,) = \Sabre\HTTP\URLUtil::splitPath($this->path);
list(, $newName) = \Sabre\HTTP\URLUtil::splitPath($name);
list($parentPath,) = \Sabre\Uri\split($this->path);
list(, $newName) = \Sabre\Uri\split($name);

// verify path of the target
$this->verifyPath();

+ 3
- 3
apps/dav/lib/Connector/Sabre/ObjectTree.php View File

@@ -80,7 +80,7 @@ class ObjectTree extends \Sabre\DAV\Tree {
private function resolveChunkFile($path) {
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
// resolve to real file name to find the proper node
list($dir, $name) = \Sabre\HTTP\URLUtil::splitPath($path);
list($dir, $name) = \Sabre\Uri\split($path);
if ($dir == '/' || $dir == '.') {
$dir = '';
}
@@ -221,7 +221,7 @@ class ObjectTree extends \Sabre\DAV\Tree {
// this will trigger existence check
$this->getNodeForPath($source);

list($destinationDir, $destinationName) = \Sabre\HTTP\URLUtil::splitPath($destination);
list($destinationDir, $destinationName) = \Sabre\Uri\split($destination);
try {
$this->fileView->verifyPath($destinationDir, $destinationName);
} catch (\OCP\Files\InvalidPathException $ex) {
@@ -238,7 +238,7 @@ class ObjectTree extends \Sabre\DAV\Tree {
throw new FileLocked($e->getMessage(), $e->getCode(), $e);
}

list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destination);
list($destinationDir,) = \Sabre\Uri\split($destination);
$this->markDirty($destinationDir);
}
}

+ 2
- 2
apps/dav/lib/Connector/Sabre/Principal.php View File

@@ -100,7 +100,7 @@ class Principal implements BackendInterface {
* @return array
*/
public function getPrincipalByPath($path) {
list($prefix, $name) = URLUtil::splitPath($path);
list($prefix, $name) = \Sabre\Uri\split($path);

if ($prefix === $this->principalPrefix) {
$user = $this->userManager->get($name);
@@ -138,7 +138,7 @@ class Principal implements BackendInterface {
* @throws Exception
*/
public function getGroupMembership($principal, $needGroups = false) {
list($prefix, $name) = URLUtil::splitPath($principal);
list($prefix, $name) = \Sabre\Uri\split($principal);

if ($prefix === $this->principalPrefix) {
$user = $this->userManager->get($name);

+ 1
- 1
apps/dav/lib/Connector/Sabre/QuotaPlugin.php View File

@@ -91,7 +91,7 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
if (substr($uri, 0, 1) !== '/') {
$uri = '/' . $uri;
}
list($parentUri, $newName) = URLUtil::splitPath($uri);
list($parentUri, $newName) = \Sabre\Uri\split($uri);
if(is_null($parentUri)) {
$parentUri = '';
}

+ 1
- 1
apps/dav/lib/DAV/SystemPrincipalBackend.php View File

@@ -163,7 +163,7 @@ class SystemPrincipalBackend extends AbstractBackend {
* @return array
*/
function getGroupMembership($principal) {
list($prefix, $name) = URLUtil::splitPath($principal);
list($prefix, $name) = \Sabre\Uri\split($principal);

if ($prefix === 'principals/system') {
$principal = $this->getPrincipalByPath($principal);

+ 1
- 1
apps/dav/lib/Files/FilesHome.php View File

@@ -53,7 +53,7 @@ class FilesHome extends Directory {
}

function getName() {
list(,$name) = URLUtil::splitPath($this->principalInfo['uri']);
list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']);
return $name;
}


+ 1
- 1
apps/dav/lib/Files/RootCollection.php View File

@@ -39,7 +39,7 @@ class RootCollection extends AbstractPrincipalCollection {
* @return INode
*/
function getChildForPrincipal(array $principalInfo) {
list(,$name) = URLUtil::splitPath($principalInfo['uri']);
list(,$name) = \Sabre\Uri\split($principalInfo['uri']);
$user = \OC::$server->getUserSession()->getUser();
if (is_null($user) || $name !== $user->getUID()) {
// a user is only allowed to see their own home contents, so in case another collection

Loading…
Cancel
Save