Skip to content

Commit

Permalink
fix: Pass parent to NonExistingFile instances
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Sep 6, 2023
1 parent 7ee34a3 commit 0dfddfc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/private/Files/Node/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class File extends Node implements \OCP\Files\File {
* @return NonExistingFile non-existing node
*/
protected function createNonExistingNode($path) {
return new NonExistingFile($this->root, $this->view, $path);
return new NonExistingFile($this->root, $this->view, $path, $this->root->get(dirname($path)));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Files/Node/HookConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ private function getNodeForPath(string $path): Node {
$info = null;
}
if (Filesystem::is_dir($path)) {
return new NonExistingFolder($this->root, $this->view, $fullPath, $info);
return new NonExistingFolder($this->root, $this->view, $fullPath, $info, $this->root->get(dirname($fullPath)));
} else {
return new NonExistingFile($this->root, $this->view, $fullPath, $info);
return new NonExistingFile($this->root, $this->view, $fullPath, $info, $this->root->get(dirname($fullPath)));
}
}
if ($info->getType() === FileInfo::TYPE_FILE) {
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Files/Node/NodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public function testCopySameStorage() {
$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))
$this->root->expects($this->any())
->method('get')
->willReturnMap([
['/bar/asd', $newNode],
Expand Down

0 comments on commit 0dfddfc

Please sign in to comment.