Repository navigation
Description
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug.
- This issue is not already reported on Github OR solved at the Community Help Forum.
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level.
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
When accessing a password-protected public link share in Nextcloud 32 in an existing browser session where the frontend authentication token is present in the session (public_link_authenticated_frontend), the page renders the share UI (HTTP 200 showShare), displaying the folder name and table headers without re-prompting for a password.
However, when the Vue.js files application issues a WebDAV request (PROPFIND /public.php/dav/files/<token>/), OCA\DAV\Connector\Sabre\PublicAuth::checkToken() calls isShareInSession(). Because isShareInSession() only checks self::DAV_AUTHENTICATED (public_link_authenticated numeric ID array), it fails and throws Sabre\DAV\Exception\NotAuthenticated (HTTP 401).
The frontend UI displays a fatal error:
Unexpected error: Invalid response: 401 with a "Retry" button.
Clicking "Retry" merely re-triggers the failing PROPFIND request, and refreshing the page hits showShare (which still considers the frontend authenticated and returns 200 OK), leaving the user trapped in an infinite 401 loop with no way to re-enter credentials or see the files.
Steps to reproduce
- Create a password-protected public share of a folder.
- Authenticate to the share in a browser session.
- Cause or encounter a state where
public_link_authenticated_frontendis retained in the session (e.g., after session rotation, multi-tab access, or partial session deserialization), but thepublic_link_authenticatedarray does not contain the numeric$share->getId(). - Navigate directly to
https://<domain>/s/<token>. - Notice the folder header renders (HTTP 200), but the file list displays
Invalid response: 401becausePROPFIND /public.php/dav/files/<token>/returns 401.
Expected behavior
WebDAV authenticator (PublicAuth) should be aware of frontend authentication session (public_link_authenticated_frontend), or showShare() should proactively populate PublicAuth::DAV_AUTHENTICATED with the verified share ID on page render.
Nextcloud Server version
32 (reproducible on 32.0.14, 32.0.15 and current master)
Operating system / Webserver / Database
- OS: RHEL / CentOS
- Webserver: Apache (PHP-FPM)
- Database: PostgreSQL
Proposed Fix
In apps/dav/lib/Connector/Sabre/PublicAuth.php, update isShareInSession() to fall back to public_link_authenticated_frontend:
private function isShareInSession(IShare $share): bool {
if ($this->session->exists(self::DAV_AUTHENTICATED)) {
$allowedShareIds = $this->session->get(self::DAV_AUTHENTICATED);
if (is_array($allowedShareIds) && in_array($share->getId(), $allowedShareIds, true)) {
return true;
}
}
if ($this->session->exists('public_link_authenticated_frontend')) {
$frontendTokens = json_decode($this->session->get('public_link_authenticated_frontend') ?? '[]', true);
if (is_array($frontendTokens) && ($frontendTokens[$share->getToken()] ?? '') === $share->getPassword()) {
$this->addShareToSession($share);
return true;
}
}
return false;
}Additionally, in apps/files_sharing/lib/Controller/ShareController.php within showShare():
$allowedShareIds = $this->session->get(PublicAuth::DAV_AUTHENTICATED);
if (!is_array($allowedShareIds)) {
$allowedShareIds = [];
}
if (!in_array($share->getId(), $allowedShareIds, true)) {
$allowedShareIds[] = $share->getId();
$this->session->set(PublicAuth::DAV_AUTHENTICATED, $allowedShareIds);
}Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Voltra commentedon Oct 31, 2026
Observed in production since upgrade
Voltra commentedon Nov 3, 2026
For further context: This is valid for password-protected public shares created after the update to 35.x, but also for shares created before the update. It affects all password-protected public shares
Voltra commentedon Nov 4, 2026
nextcloud--server--64659.patch
A quick patch I made with your proposed fixes
To test it out, might need to apply with:
DerDreschner commentedon Nov 7, 2026
Fixed by #66178.