Repository navigation
Do not copy skeleton on avatar access - #22410
Conversation
|
By analyzing the blame information on this pull request, we identified @DeepDiver1975, @Xenopathic and @blizzz to be potential reviewers |
There was a problem hiding this comment.
This does not work in case the user home is defined by getHome ?
There was a problem hiding this comment.
Yes. You mean the LDAP home folder naming rule.
There was a problem hiding this comment.
Best would be to add a parameter to getUserFolder that allows to specify that the folder should not be generated if it doesn't exists and a exception should be thrown instead
There was a problem hiding this comment.
There was a problem hiding this comment.
I know - I wrote it :P
There was a problem hiding this comment.
So then if that would not work for the ldap naming scheme... then well... getUserFolder would just not work for ldap users...
Ah. Now I got it.
I tought about adding the extra parameter but I think that bring more harm... since then the returned folder changes... now it is /files and then it would just return which seems like asking for trouble.
I would throw a DoesNotExistException in that case. No other magic required. Let the callee deal with it if there is no need to create a user folder.
There was a problem hiding this comment.
Yeah but we do a bit more here. Basically I want the user folder to be created. Just not the <user>/files folder and no skeleton stuff to be copied.
Feels weird to have that with a flag... I would expect such a flag would either create or not... not create 1 but not the other...
There was a problem hiding this comment.
But lets do a different (less invasive) fix...
There was a problem hiding this comment.
Yeah but we do a bit more here. Basically I want the user folder to be created. Just not the /files folder and no skeleton stuff to be copied.
Feels weird to have that with a flag... I would expect such a flag would either create or not... not create 1 but not the other...
Good point. I didn't thought about this. :(
There was a problem hiding this comment.
Ok fixed it... now we just do a get on the rootfolder... if the folder is not there a NotFoundException will be thrown... This is handled nicely by the avatar controller... We should think about a better solution for the avatar storage in 9.1. But for now this fix is as elegant (and non invasive) as it is going to get I think.
Fixes #22119 Just try to get the folder of the user. If it is not there a NotFoundException will be thrown. Which will be handled by the avatar endpoint.
|
@MorrisJobke please have another look :) |
|
Would also like to know what our filesystem master @icewind1991 thinks of this approach |
| * Basically we do not want to copy the skeleton folder | ||
| */ | ||
| \OC\Files\Filesystem::initMountPoints($userId); | ||
| $dir = '/' . $userId; |
There was a problem hiding this comment.
This simply feels wrong for home folder naming rule setting in LDAP - but it magically also works with getUserFolder() for such an instance in another case I had yesterday 🙈
There was a problem hiding this comment.
the home folder naming is completely separate from the path within oc's virtual fs.
Inside oc's fs the user directory is always at /$userId/
There was a problem hiding this comment.
Yes, but that other PR removes that logic, see #22493
There was a problem hiding this comment.
If that works as intended, then I'm fine. Just want to make sure we don't break anything.
@icewind1991 can you double check ?
There was a problem hiding this comment.
The fs is manually setup here so #22493 doesn't affect this
There was a problem hiding this comment.
Right, makes sense.
Internally initMountPoints($userId) should be asking for the LDAP home and mount it as "/" . $userId. So it would work.
|
Tested with cron job + caldav, when retrieving the avatar it now doesn't copy the skeleton for every LDAP user 👍 |
|
Now seeing @MorrisJobke comment in detail, I retract my thumbs up 👎 It's best to never use How about adding an optional argument to |
|
👍 |
|
@PVince81 @MorrisJobke how about an extra function to IRootFolder |
|
That way we keep the nice abstraction and pure unit tests. |
No... too many APIs then. Keep it as is. Second review @icewind1991 @MorrisJobke @nickvergessen @schiesbn ? |
|
@MorrisJobke @icewind1991 second review ? Or are you still against this change ? |
|
👍 looks good |
Do not copy skeleton on avatar access
|
This seems to have broken the user management: #22550 |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #22119
We do the step from the getUserFolder function here. So we make sure
that the user folder exists. But do not create the files folder (we
don't need it here) and do not copy the skeleton.
Note that this will still be triggered once the getUserFolder is called.
Moved the unit tests to more intergration tests with the traits we have..
@PVince81 @DeepDiver1975 as promised.
@DeepDiver1975 as far as I can tell this fixes the issue... but please verify on your setup.
CC: @MorrisJobke @nickvergessen