Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filesystem setup tweaks #31901

Merged
merged 3 commits into from
Apr 8, 2022
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
11 changes: 11 additions & 0 deletions lib/private/Files/Node/LazyFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OC\Files\Node;

use OC\Files\Utils\PathHelper;
Expand Down Expand Up @@ -310,13 +311,20 @@ public function getUserFolder($userId) {
* @inheritDoc
*/
public function getMimetype() {
if (isset($this->data['mimetype'])) {
return $this->data['mimetype'];
}
return $this->__call(__FUNCTION__, func_get_args());
}

/**
* @inheritDoc
*/
public function getMimePart() {
if (isset($this->data['mimetype'])) {
[$part,] = explode('/', $this->data['mimetype']);
return $part;
}
return $this->__call(__FUNCTION__, func_get_args());
}

Expand All @@ -331,6 +339,9 @@ public function isEncrypted() {
* @inheritDoc
*/
public function getType() {
if (isset($this->data['type'])) {
return $this->data['type'];
}
return $this->__call(__FUNCTION__, func_get_args());
}

Expand Down
3 changes: 3 additions & 0 deletions lib/private/Files/Node/LazyUserFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace OC\Files\Node;

use OCP\Files\FileInfo;
use OCP\Constants;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
Expand All @@ -49,6 +50,8 @@ public function __construct(IRootFolder $rootFolder, IUser $user) {
}, [
'path' => $this->path,
'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
'mimetype' => FileInfo::MIMETYPE_FOLDER,
]);
}

Expand Down
9 changes: 7 additions & 2 deletions lib/private/Files/SetupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,12 @@ public function setupForPath(string $path, bool $includeChildren = false): void
}

// for the user's home folder, it's always the home mount
if (rtrim($path) === "/" . $user->getUID() . "/files" && !$includeChildren) {
$this->oneTimeUserSetup($user);
if (rtrim($path) === "/" . $user->getUID() . "/files") {
if ($includeChildren) {
$this->setupForUser($user);
} else {
$this->oneTimeUserSetup($user);
}
return;
}

Expand Down Expand Up @@ -460,6 +464,7 @@ public function setupForProvider(string $path, array $providers): void {

if (in_array('', $providers)) {
$this->setupForUser($user);
return;
}
$setupProviders = $this->setupUserMountProviders[$user->getUID()] ?? [];

Expand Down