]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge master 33061/head
authorPawel Boguslawski <pawel.boguslawski@ib.pl>
Fri, 4 Nov 2022 12:34:21 +0000 (13:34 +0100)
committerPawel Boguslawski <pawel.boguslawski@ib.pl>
Fri, 4 Nov 2022 12:34:21 +0000 (13:34 +0100)
1  2 
lib/private/Files/Node/Folder.php

index b0df1c9129383d4ffb4e963440f57322173fddbf,fb3c78bb8017355b32731cbbaf140958090475a3..f09faf78288e78c29234000f7d7e9b1ef5874473
@@@ -162,9 -162,10 +163,10 @@@ class Folder extends Node implements \O
                        $nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
                        $this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
                        if (!$this->view->mkdir($fullPath)) {
 -                              throw new NotPermittedException('Could not create folder');
 +                              throw new NotPermittedException('Could not create folder "' . $fullPath . '"');
                        }
-                       $node = new Folder($this->root, $this->view, $fullPath);
+                       $parent = dirname($fullPath) === $this->getPath() ? $this : null;
+                       $node = new Folder($this->root, $this->view, $fullPath, null, $parent);
                        $this->sendHooks(['postWrite', 'postCreate'], [$node]);
                        return $node;
                } else {
                                $result = $this->view->touch($fullPath);
                        }
                        if ($result === false) {
 -                              throw new NotPermittedException('Could not create path');
 +                              throw new NotPermittedException('Could not create path "' . $fullPath . '"');
                        }
-                       $node = new File($this->root, $this->view, $fullPath);
+                       $node = new File($this->root, $this->view, $fullPath, null, $this);
                        $this->sendHooks(['postWrite', 'postCreate'], [$node]);
                        return $node;
                }
                        $this->view->rmdir($this->path);
                        $nonExisting = new NonExistingFolder($this->root, $this->view, $this->path, $fileInfo);
                        $this->sendHooks(['postDelete'], [$nonExisting]);
-                       $this->exists = false;
                } else {
 -                      throw new NotPermittedException('No delete permission for path');
 +                      throw new NotPermittedException('No delete permission for path "' . $this->path . '"');
                }
        }