Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Storage/DirMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class DirMask extends PermissionsMask {
*/
public function __construct($arguments) {
parent::__construct($arguments);
$this->path = $arguments['path'];
$this->path = rtrim($arguments['path'], '/');
$this->pathLength = strlen($arguments['path']);
$this->mask = $arguments['mask'];
}

protected function checkPath($path): bool {
return substr($path, 0, $this->pathLength) === $this->path;
return $path === $this->path || substr($path, 0, $this->pathLength + 1) === $this->path . '/';
}

public function isUpdatable($path): bool {
Expand Down
27 changes: 0 additions & 27 deletions lib/Storage/ReadOnlyJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,6 @@
* read only mask for home storages
*/
class ReadOnlyJail extends DirMask {

/**
* @param $path
* @return bool
*/
protected function checkPath($path): bool {
if ($path === 'files') {
return true;
}

return parent::checkPath($path);
}


/**
* @param string $path
* @return bool
Expand All @@ -37,17 +23,4 @@ public function isDeletable($path): bool {

return $this->getWrapperStorage()->isDeletable($path);
}

/**
* @param string $path
* @return bool
*/
public function mkdir($path): bool {
// Lift restrictions if files dir is created (at first login)
if ($path === 'files') {
return $this->storage->mkdir($path);
} else {
return parent::mkdir($path);
}
}
}
Loading