nextcloud / nextcloud/server

[Bug]: first request to favicon on a fresh installation tries to create a folder on /

Open
#42,509 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop 28-feedback bug feature: install and update feature: theming papercut
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

On a fresh installation of Nextcloud, the very first request to a favicon results in:

[index] Error: Could not create folder00000000 "/appdata_ocuvkl7tn30j/theming/global" for path "global"
	GET /apps/theming/favicon?v=b6589fc6
	from 2a02:810d:c0:9ef1:372a:20b8:38ac:ffa3 by -- at Dec 28, 2023, 8:07:05 PM

Full trace:

{"reqId":"tSUZlPWyUmhC4RGDQGC4","level":3,"time":"2023-12-28T19:07:05+00:00","remoteAddr":"2a02:810d:c0:9ef1:372a:20b8:38ac:ffa3","user":"--","app":"index","method":"GET","url":"/apps/theming/favicon?v=b6589fc6","message":"Could not create folder00000000 \"/appdata_ocuvkl7tn30j/theming/global\" for path \"global\"","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0","version":"28.0.1.1","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create folder00000000 \"/appdata_ocuvkl7tn30j/theming/global\" for path \"global\"","Code":0,"Trace":[{"file":"/app/code/lib/private/Files/AppData/AppData.php","line":147,"function":"newFolder","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/app/data/apps/theming/lib/ImageManager.php","line":367,"function":"newFolder","class":"OC\\Files\\AppData\\AppData","type":"->"},{"file":"/app/data/apps/theming/lib/ImageManager.php","line":101,"function":"getRootFolder","class":"OCA\\Theming\\ImageManager","type":"->"},{"file":"/app/data/apps/theming/lib/Controller/IconController.php","line":127,"function":"getImage","class":"OCA\\Theming\\ImageManager","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getFavicon","class":"OCA\\Theming\\Controller\\IconController","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/app/code/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/app/code/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/app/code/lib/private/Files/Node/Folder.php","Line":162,"message":"Could not create folder00000000 \"/appdata_ocuvkl7tn30j/theming/global\" for path \"global\"","exception":[],"CustomMessage":"Could not create folder00000000 \"/appdata_ocuvkl7tn30j/theming/global\" for path \"global\""},"id":"658dc81bd1008"}

Subsequent request are fine.

Steps to reproduce
  1. Fresh installation
  2. Visit login page
  3. check error log file
Expected behavior

The issue appears that this request results in the attempt to create the folder "/appdata_ocuvkl7tn30j/theming/global" which is actually on "/" (root fs)

Expected is that it would create it in the AppData root folder (in our case /app/data/data/)
I only managed to trace it down to the point where it seems that some code path creates an AppData object without or an empty rootFolder.

Installation method

Other Community project

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

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

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

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

Reproduce the first favicon request on a fresh installation, then start with apps/theming/lib/ImageManager.php at getRootFolder and lib/private/Files/AppData/AppData.php at newFolder. Trace how the AppData object receives its root folder; done means the request creates theming/global under the AppData root and produces no folder-creation error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.