File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public function handle(Event $event): void {
4848 $ user = $ this ->userSession ->getUser ();
4949 if ($ user ) {
5050 $ viewOnlyHandler = new ViewOnly (
51- $ this ->rootFolder
51+ $ this ->rootFolder -> getUserFolder ( $ user -> getUID ())
5252 );
5353 if (!$ viewOnlyHandler ->check ($ pathsToCheck )) {
5454 $ event ->setErrorMessage ('Access to this resource or one of its sub-items has been denied. ' );
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public function __construct(
2424 }
2525
2626 /**
27- * @param string[] $pathsToCheck
27+ * @param string[] $pathsToCheck paths to check, relative to the user folder
2828 * @return bool
2929 */
3030 public function check (array $ pathsToCheck ): bool {
Original file line number Diff line number Diff line change 2121 * @since 25.0.0
2222 */
2323class BeforeZipCreatedEvent extends Event {
24- private string $ directory ;
24+ private ? string $ directory = null ;
2525 private bool $ successful = true ;
2626 private ?string $ errorMessage = null ;
2727 private ?Folder $ folder = null ;
2828
2929 /**
30+ * @param string|Folder $directory Folder instance, or (deprecated) string path relative to user folder
3031 * @param list<string> $files
3132 * @since 25.0.0
3233 * @since 31.0.0 support `OCP\Files\Folder` as `$directory` parameter - passing a string is deprecated now
@@ -37,7 +38,6 @@ public function __construct(
3738 ) {
3839 parent ::__construct ();
3940 if ($ directory instanceof Folder) {
40- $ this ->directory = $ directory ->getPath ();
4141 $ this ->folder = $ directory ;
4242 } else {
4343 $ this ->directory = $ directory ;
@@ -53,8 +53,13 @@ public function getFolder(): ?Folder {
5353
5454 /**
5555 * @since 25.0.0
56+ * @deprecated 33.0.0 Use getFolder instead and use node API
57+ * @return string returns folder path relative to user folder
5658 */
5759 public function getDirectory (): string {
60+ if ($ this ->folder instanceof Folder) {
61+ return preg_replace ('|^/[^/]+/files/| ' , '/ ' , $ this ->folder ->getPath ());
62+ }
5863 return $ this ->directory ;
5964 }
6065
You can’t perform that action at this time.
0 commit comments