Fix: NotFoundException for anonymous users#50958
Conversation
Signed-off-by: Kostiantyn Miakshyn <[email protected]>
|
/backport to stable31 |
|
/backport to stable30 |
|
/backport to stable29 |
|
|
||
| $owner = $node->getOwner()?->getUid(); | ||
| try { | ||
| $owner = $node->getOwner()?->getUid(); |
There was a problem hiding this comment.
Is this not a deeper problem @come-nc ?
So this method is not marked as throwing, but just to return null if not found.
Meaning should we fix the getOwner method or at least add the throwing to the docs?
There was a problem hiding this comment.
This is how we manage non-existing files, see https://github.com/nextcloud/server/blob/master/lib/private/Files/Node/NonExistingFile.php
We could mark all methods as throwing but that would trigger a lot of false positive.
There was a problem hiding this comment.
Actually for getOwner the throw comes from Node::getFileInfo directly I think.
There was a problem hiding this comment.
But in this case the file exists
There was a problem hiding this comment.
No it does not.
Look at the trace in nextcloud/forms#2435
It’s triggered by rename hook, so either source or target does not exist, depending if we are in the pre- or post- rename hook/event.
Checklist