mirror of
https://github.com/nextcloud/server.git
synced 2026-04-23 07:08:34 -04:00
fix: Pass parent to NonExistingFile instances
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
c6e6ebb999
commit
7f958e81d3
2 changed files with 11 additions and 3 deletions
|
|
@ -297,10 +297,19 @@ class Node implements INode {
|
|||
return $this->root;
|
||||
}
|
||||
|
||||
// Manually fetch the parent if the current node doesn't have a file info yet
|
||||
try {
|
||||
$fileInfo = $this->getFileInfo();
|
||||
} catch (NotFoundException) {
|
||||
$this->parent = $this->root->get($newPath);
|
||||
/** @var \OCP\Files\Folder $this->parent */
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
// gather the metadata we already know about our parent
|
||||
$parentData = [
|
||||
'path' => $newPath,
|
||||
'fileid' => $this->getFileInfo()->getParentId(),
|
||||
'fileid' => $fileInfo->getParentId(),
|
||||
];
|
||||
|
||||
// and create lazy folder with it instead of always querying
|
||||
|
|
|
|||
|
|
@ -481,8 +481,7 @@ abstract class NodeTest extends \Test\TestCase {
|
|||
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
|
||||
$newNode = $this->createTestNode($this->root, $this->view, '/bar/asd');
|
||||
|
||||
$this->root->expects($this->exactly(2))
|
||||
->method('get')
|
||||
$this->root->method('get')
|
||||
->willReturnMap([
|
||||
['/bar/asd', $newNode],
|
||||
['/bar', $parentNode]
|
||||
|
|
|
|||
Loading…
Reference in a new issue