aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/DAV/Tree.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-03 10:53:37 +0000
committerMario <mario@mariovavti.com>2024-01-03 10:53:37 +0000
commit322b619a7122fa812321ceb67016e0b1ce4affb6 (patch)
tree660fd384b04db56763d7bc2a18c1c18173f19f6e /vendor/sabre/dav/lib/DAV/Tree.php
parentdff906ca69efbb8ae18e9954ec7a937e36b50308 (diff)
downloadvolse-hubzilla-322b619a7122fa812321ceb67016e0b1ce4affb6.tar.gz
volse-hubzilla-322b619a7122fa812321ceb67016e0b1ce4affb6.tar.bz2
volse-hubzilla-322b619a7122fa812321ceb67016e0b1ce4affb6.zip
update sabre/dav
Diffstat (limited to 'vendor/sabre/dav/lib/DAV/Tree.php')
-rw-r--r--vendor/sabre/dav/lib/DAV/Tree.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/vendor/sabre/dav/lib/DAV/Tree.php b/vendor/sabre/dav/lib/DAV/Tree.php
index 8215e2c39..65b4583ce 100644
--- a/vendor/sabre/dav/lib/DAV/Tree.php
+++ b/vendor/sabre/dav/lib/DAV/Tree.php
@@ -16,7 +16,7 @@ use Sabre\Uri;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Tree
+class Tree implements INodeByPath
{
/**
* The root node.
@@ -62,20 +62,26 @@ class Tree
return $this->rootNode;
}
- // Attempting to fetch its parent
- list($parentName, $baseName) = Uri\split($path);
+ $parts = explode('/', $path);
+ $node = $this->rootNode;
- // If there was no parent, we must simply ask it from the root node.
- if ('' === $parentName) {
- $node = $this->rootNode->getChild($baseName);
- } else {
- // Otherwise, we recursively grab the parent and ask him/her.
- $parent = $this->getNodeForPath($parentName);
-
- if (!($parent instanceof ICollection)) {
+ while (count($parts)) {
+ if (!($node instanceof ICollection)) {
throw new Exception\NotFound('Could not find node at path: '.$path);
}
- $node = $parent->getChild($baseName);
+
+ if ($node instanceof INodeByPath) {
+ $targetNode = $node->getNodeForPath(implode('/', $parts));
+ if ($targetNode instanceof Node) {
+ $node = $targetNode;
+ break;
+ }
+ }
+
+ $part = array_shift($parts);
+ if ('' !== $part) {
+ $node = $node->getChild($part);
+ }
}
$this->cache[$path] = $node;