-
Notifications
You must be signed in to change notification settings - Fork 68
Properly construct path of root on file rename #226
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
Conversation
If you have a file in your root folder. And you rename that file. We will try to find who has access to the parent. In this case the parent of is the root folder of the user. So sections is only 3 elements big. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/FilesHooks.php
Outdated
| $accessList['ownerPath'] = '/' . $sections[3]; | ||
|
|
||
| $accessList['ownerPath'] = '/'; | ||
| if (count($sections) === 4) { |
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.
I would use an isset($sections[3]) because it makes semantically more sense (4+ elements is fine and it actually tests, the element that is actually used later - [0 => 'a', 1 => 'b', 2 => 'c', 4 => 'd'] is also an array of the length 4 😉 (even if it is not typical to be the case here)
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.
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.
but sure
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.
I know, this is just about better practises and easier to understand code snippets.
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.
Sounds good, but yeah isset on 3 seems more logical.
Thanks for finding the issue.
Signed-off-by: Joas Schilling <coding@schilljs.com>
54a1855 to
50e2398
Compare
|
Should backport to 12? |
|
Or is it just a php notice? |
|
@nickvergessen Looking at #163 I would backport it to 12. |
If you have a file in your root folder. And you rename that file. We
will try to find who has access to the parent. In this case the parent
of is the root folder of the user. So sections is only 3 elements big.
Found on our sentry instance.