-
Notifications
You must be signed in to change notification settings - Fork 87
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
Check for naming conflicts before returning the user mounts #523
Conversation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@rullzer Any feedback on the approach? I think performance wise this should be fine since it basically adds only one check for existing file by default. |
@@ -85,7 +85,19 @@ public function getFoldersForUser(IUser $user) { | |||
public function getMountsForUser(IUser $user, IStorageFactory $loader) { | |||
$folders = $this->getFoldersForUser($user); | |||
|
|||
return array_map(function ($folder) use ($user, $loader) { | |||
/** @var Folder $folder */ | |||
$userHome = \OC::$server->getRootFolder()->getUserFolder($user->getUID()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this trigger cyclic things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't seem so when testing, but indeed this seems like it could cause issues. I'll dig a bit deeper tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, as the mountpoints are only setup once for the user. So when getRootFolder is called, initMountPoints will not execute again.
The issue I see would be that mount providers that are registered after the group folder provider don't have their mountpoints added to the user root at that point. For sharing mounts this is handled by manually forcing that mount provider to be the last mounted. https://github.com/nextcloud/server/blob/3ad6084891b88b3b7ef784bbf297b0a57b282d77/lib/private/Files/Config/MountProviderCollection.php#L93-L101
But I assume we should only rename regular users files anyway, so that shouldn't be an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok lets just try it then...
Signed-off-by: Julius Härtl <jus@bitgrid.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets give this a shot
@icewind1991 Would be great if you could have a look as well |
/backport to stable4 |
backport to stable4 in #568 |
Fixes #18 |
Ok so I was right. It does make boom. Due to cyclic nitialization. And actually causes: #597 |
This PR makes sure we check and rename existing files/shares to a unique name before the groupfolder mount is added to the user mounts.