-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
\OC\Share\Share::getUsersSharingFile does not work properly with renamed shares and groups #15952
Comments
cc @PVince81 I guess that was what I was stumbled about… |
This works properly if directly sharing to the user. |
… I wonder what this may all potentially break in core … |
But strangely encryption works fine, and it uses that. But let me try the steps, maybe this is yet another nuance. |
also CC @schiesbn |
After running the steps, I put the contents into "test.php" and open it in the browser:
Hmm, but as the admin I'd expect to have "test" there too. |
Wait what ? "/sharedtest.txt" ? Looks like a missing slash. |
Ok, forgot to say that my file is called "test8.txt" not "test.txt". But still, might be another bug ?! |
Okay now, when pointing the API call at the correct file:
At least now the result is consistent with @LukasReschke. Now if that is really broken, it means encryption (share keys) should break too. Trying encryption now... |
Now I also wonder, are we supposed to call |
When calling it like this: I get:
Nope 😦 Trying encryption now. |
Bad news, encryption breaks too, here are the steps (on stable8):
Expected: file can be downloaded It is likely that the shared keys for the second user weren't created properly because of the incomplete result returned by |
@PVince81 I can't reproduce it. I started with a fresh installation of stable8 and followed exactly your steps. after step 11 I checked the keys in data/admin/files_encryption. Share-keys exists for "admin", "test" and "test2", so all shares were resolved correctly. If I log-in as "test2" I can open the file. |
Ok, let me double check the steps then and add as many details as possible. |
@schiesbn you're right, executing my exact steps do work... damn. I'll try and find out how I triggered it. I still don't understand how encryption manages to get the correct users when calling |
Okay, I got something: if I add <?php
require_once('./lib/base.php');
\OC_Util::setupFS();
$file = '/foo/test.txt';
//list($owner, $ownerPath) = \OCA\Files_Encryption\Util::getUidAndFilename($file);
list($owner, $ownerPath) = \OCA\Files_Versions\Storage::getUidAndFilename($file);
var_dump($owner);
var_dump($ownerPath);
var_dump(\OC\Share\Share::getUsersSharingFile($ownerPath, $owner, true, true)); When run as "test", I get this:
But if I comment out setupFS and the other one, I only get the admin. At least it makes sense... Now to the original issue: the path of "test" is wrong and should be "foo" instead of "shared". |
Yes, encryption first resolve the owner and the owner path and then check the shares from the owners perspective. Encryption also only needs the list of owners, we don't care about the path. So the issue described here shouldn't have any influence on encryption. |
And it seems that the resolution itself somehow affects the state of the FS statically, which makes it work... |
The code that builds the paths is here: https://github.com/owncloud/core/blob/stable8/lib/private/share/share.php#L162 |
I'm writing a unit test first, in the spirit of "test first" |
PR here: #15961 (only contains a unit test to reproduce the issue) |
@nickvergessen has fixed this here #17330 |
\OC\Share\Share::getUsersSharingFile
is not properly working in combination with renamed shares and groups on stable8 (didn't test master yet – suspect it to be broken as well), this can be reproduced by:Create a file with the following content and access it as admin:
Return will be:
Obviously it should resolve to
foo
instead ofshared
for the user "test".cc @icewind1991
The text was updated successfully, but these errors were encountered: