nextcloud / nextcloud/server

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

Open
#50,103 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 30-feedback bug
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ 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":"/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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the upload request through apps/deck/lib/Service/FilesAppService.php, AttachmentService.php, and AttachmentController.php, then inspect how lib/private/AppFramework/Http/Dispatcher.php handles the exception. Reproduce the guest or blocked-flow upload and verify that a permission-denied response is shown instead of the generic internal server error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.