Skip to content

[Bug]: Generic error message when not allowed to upload files as guest or not permitted via flow. #50103

@small1

Description

@small1

⚠️ This issue respects the following points: ⚠️

Bug description

If a user uploads a file and is prevented for uploads. For example as a Guest user or that a flow prevents the upload. The user is sent a quite cryptic internal server error instead of a more proper Not allowed error.

Nextcloud is throwing a not permitted exception. in the logs but the frontend doesnt handle that and shows a generic nextcloud error.

Image

This exception should be caught and show a more descriptive error. For example could not create folder to upload (in the case of deck and guests) Or path not allowed to upload to in case of a blocking flow.

Steps to reproduce

  1. Create a flow that prevents an upload
  2. Try to upload a file
  3. Get the internal server error

OR

  1. login as guest user
  2. try to upload a file in Deck for example.
  3. Get the internal server error

Expected behavior

Get a permission denied error

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

{"reqId":"8Q8qotgIWKUl3zgHAgSb","level":3,"time":"2025-01-09T10:20:24+00:00","remoteAddr":"185.47.43.229","user":"johanbb","app":"deck","method":"POST","url":"/https/github.com/apps/deck/cards/46/attachment","message":"Exception thrown: OCP\\Files\\NotPermittedException","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36","version":"30.0.3.2","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"No create permission for path \"me.png\"","Code":0,"Trace":[{"file":"/var/www/nextcloud/demo/apps/deck/lib/Service/FilesAppService.php","line":188,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/nextcloud/demo/apps/deck/lib/Service/AttachmentService.php","line":195,"function":"create","class":"OCA\\Deck\\Service\\FilesAppService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/demo/apps/deck/lib/Controller/AttachmentController.php","line":53,"function":"create","class":"OCA\\Deck\\Service\\AttachmentService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/demo/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"create","class":"OCA\\Deck\\Controller\\AttachmentController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/demo/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/demo/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/demo/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/demo/lib/base.php","line":1003,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/demo/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/demo/lib/private/Files/Node/Folder.php","Line":178,"CustomMessage":"Exception thrown: OCP\\Files\\NotPermittedException"}}

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap30-feedbackbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions