-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
fix share roots always being marked as writable #38179
Conversation
lib/public/Files/DavUtil.php
Outdated
// since we always add update permissions for the root of movable mounts (and thus shares) | ||
// we need to check the shared cache item directly to determine if it's writable | ||
$storage = $info->getStorage(); | ||
if ($info->getInternalPath() === '' && $storage->instanceOfStorage(SharedStorage::class)) { |
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.
Weird psalm error 🤔
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.
OCP cannot use stuff from OC or OCA
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.
@icewind1991 Can this be put into isUpdatable
instead?
Or in new methods isWritable
/…?
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.
Can't be put into isUpdatable
because that is also used to check for rename permissions.
Adding a new method to the interface is wrought with compatibility pitfalls
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.
is wrought with compatibility pitfalls
what would those be?
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.
It means that any (possibly 3rdparty) implementation of the interface needs to be updated as well
Any update in this? Would be cool if we could solve #1606 soon |
18c9f40
to
910e79f
Compare
910e79f
to
ad7ad62
Compare
Wrong ticket number I suppose? |
Oh okay wrong repository, it’s nextcloud/viewer#1606 |
lib/public/Files/DavUtil.php
Outdated
// since we always add update permissions for the root of movable mounts (and thus shares) | ||
// we need to check the shared cache item directly to determine if it's writable | ||
$storage = $info->getStorage(); | ||
if ($info->getInternalPath() === '' && $storage->instanceOfStorage(SharedStorage::class)) { |
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.
if ($info->getInternalPath() === '' && $storage->instanceOfStorage(SharedStorage::class)) { | |
/** @psalm-suppress UndefinedClass files_sharing may be disabled but this will still work as expected */ | |
if ($info->getInternalPath() === '' && $storage->instanceOfStorage(SharedStorage::class)) { |
Add a suppress like this then, I do not see a better way. And ::class
does not actually complains on non-existing classes so it should be fine. Maybe still test this with files_sharing disabled to be sure.
A clean fix would be to add a new interface for this, like IWritableAwareStorage, and change the code for:
if ($info->getInternalPath() === '' && $storage->instanceOfStorage(SharedStorage::class)) { | |
if ($storage->instanceOfStorage(IWritableAwareStorage::class)) { | |
$isWritable = $storage->isWritable($info); |
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.
ping @icewind1991
ad7ad62
to
533456d
Compare
Hello there! What is the current status on this? Assume another review round is needed? Or is there still a disagreement that we need to resolve on how to solve this issue? Would be cool if we could cross this issue off soon 💙 Cheers |
533456d
to
d82f21e
Compare
Switched to checking for |
Thanks for looking into this @icewind1991! Am I right in thinking that we can't backport this? |
Some CI runs are failling. |
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 good
More approvals will not help, I'm afraid. the tests and CI failures need to be fixed cc @icewind1991 |
I need this to be merged as soon as possible for a customer |
Signed-off-by: Robin Appelman <robin@icewind.nl>
d82f21e
to
0186a94
Compare
Signed-off-by: Robin Appelman <robin@icewind.nl>
0186a94
to
8af60b9
Compare
#39614 for the backport |
Since movable mounts are always marked as "updatable" some extra logic is needed to split "updatable" into "renamable" and "writable"
Fixes nextcloud/viewer#1606