Skip to content

Conversation

@Koc
Copy link
Contributor

@Koc Koc commented Feb 21, 2025

Checklist

@come-nc come-nc added this to the Nextcloud 32 milestone Feb 24, 2025
@come-nc come-nc requested review from artonge and susnux February 24, 2025 09:01
@come-nc
Copy link
Contributor

come-nc commented Feb 24, 2025

/backport to stable31

@come-nc
Copy link
Contributor

come-nc commented Feb 24, 2025

/backport to stable30

@come-nc
Copy link
Contributor

come-nc commented Feb 24, 2025

/backport to stable29


$owner = $node->getOwner()?->getUid();
try {
$owner = $node->getOwner()?->getUid();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually for getOwner the throw comes from Node::getFileInfo directly I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in this case the file exists

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Koc Koc merged commit b9d1dd2 into master Feb 24, 2025
190 checks passed
@Koc Koc deleted the bugfix/fix-not-found-exception-for-anonymous-users branch February 24, 2025 15:12
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 19, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OCP\Files\NotFoundException thrown when a file is submitted via link share and user is not logged in

5 participants