[DAV] Fix URLUtil::splitPath usage
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
f57a3aa81b
commit
fc369dd86e
14 changed files with 23 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 = '';
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue