Skip to content

LoadViewerListener crashes on public share links (null userId) #6

Description

@netfreak98

When accessing a public share link, the files_reader app causes an Internal Server Error because LoadViewerListener doesn't handle anonymous (unauthenticated) access (from some browsers like Firefox)

Steps to reproduce
Create a share link for any file
Open the share link in an incognito browser (not logged in)

Nextcloud returns "Internal Server Error"
Error message

OCA\Files_Reader\Listeners\LoadViewerListener::__construct(): Argument #3 ($userId) must be of type string, null given, called in /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 69 in file '/var/www/nextcloud/apps/files_reader/lib/Listeners/LoadViewerListener.php' line 32

Root cause
In lib/Listeners/LoadViewerListener.php, the constructor declares:

userId ? $this->config->getUserValue($this->userId, ...) : 'true'; ``` Environment files_reader version: 1.5.3 Nextcloud version: 32.0.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions