Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: Application without an icon is causing a runtime exception

未关闭 适合新手
#59,728 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
php
领域
backend

调研方向

从 lib/private/NavigationManager.php 和 lib/private/URLGenerator.php 开始,然后使用其 appinfo/info.xml 省略导航图标的生成应用重现该故障。跟踪默认图标路径的解析方式。完成的标准是:没有该可选条目的已启用应用能够加载通常的 Web 界面,且不会出现运行时异常。

由索引模型根据 Issue 内容生成。

描述

0. Needs triage 32-feedback bug
⚠️ This issue respects the following points: ⚠️
Bug description

A third-party application without a navigations/navigation/icon entry in the appinfo/info.xml file is causing a runtime exception once the app is enabled, because the default-app-icon.svg file cannot be found.

The issue seems to be that the default-app-icon.svg file is shipped in this folder:

core/img/places/default-app-icon.svg

The lib/private/NavigationManager.php tries to get the imagePath like this:

if ($icon === null) {
  $icon = $this->urlGenerator->imagePath('core', 'default-app-icon');
}

The imagePath function in the lib/private/URLGenerator.php file has a very large if/else block for searching all kinds of folders, but the core/img/places folder is not part of that.

Based on the developer manual the navigations/navigation/icon entry is optional, so Nextcloud should be able to handle it:

https://docs.nextcloud.com/server/latest/developer_manual/app_development/info.html

Steps to reproduce
  1. Have a working Nextcloud installation, make sure the web interface works

  2. Generate a helloworld application with the application generator:

    https://apps.nextcloud.com/developer/apps/generate

  3. Extract the archive, put it into the apps folder, give it proper permissions, etc.

  4. Edit the appinfo/info.xml file manually, remove the navigations/navigation/icon line entirely.

  5. Enable the application with occ app:enable helloworld

  6. Refresh the Nextcloud page in your browser, you should see a runtime exception with an error message

Expected behavior

Nextcloud should display the usual web interface instead of the runtime exception.

Nextcloud Server version

32

Operating system

Other

PHP engine version

PHP 8.4

Web server

Nginx

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?

None

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":"lpHmBHRz36uuCcFhxJ2V","level":3,"time":"2026-04-20T11:31:45+00:00","remoteAddr":"192.168.2.200","user":"udi","app":"index","method":"GET","url":"/index.phpboard/","scriptName":"/index.php","message":"image not found: image:default-app-icon webroot: serverroot:/var/www/nextcloud/htdocs","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:149.0) Gecko/20100101 Firefox/149.0","version":"32.0.6.1","exception":{"Exception":"RuntimeException","Message":"image not found: image:default-app-icon webroot: serverroot:/var/www/nextcloud/htdocs","Code":0,"Trace":[{"file":"/var/www/nextcloud/htdocs/lib/private/NavigationManager.php","line":378,"function":"imagePath","class":"OC\\URLGenerator","type":"->","args":["core","default-app-icon"]},{"file":"/var/www/nextcloud/htdocs/lib/private/NavigationManager.php","line":125,"function":"init","class":"OC\\NavigationManager","type":"->","args":[]},{"file":"/var/www/nextcloud/htdocs/lib/private/TemplateLayout.php","line":77,"function":"getAll","class":"OC\\NavigationManager","type":"->","args":[]},{"file":"/var/www/nextcloud/htdocs/lib/private/Template/Template.php","line":115,"function":"getPageTemplate","class":"OC\\TemplateLayout","type":"->","args":["user","dashboard"]},{"file":"/var/www/nextcloud/htdocs/lib/public/AppFramework/Http/TemplateResponse.php","line":195,"function":"fetchPage","class":"OC\\Template\\Template","type":"->","args":[{"id-app-content":"#app-dashboard","id-app-navigation":null,"pageTitle":"Ir\u00e1ny\u00edt\u00f3pult"}]},{"file":"/var/www/nextcloud/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":163,"function":"render","class":"OCP\\AppFramework\\Http\\TemplateResponse","type":"->","args":[]},{"file":"/var/www/nextcloud/htdocs/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Dashboard\\Controller\\DashboardController"},"index"]},{"file":"/var/www/nextcloud/htdocs/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Dashboard\\Controller\\DashboardController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"dashboard.dashboard.index"}]},{"file":"/var/www/nextcloud/htdocs/lib/base.php","line":1091,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/dashboard/"]},{"file":"/var/www/nextcloud/htdocs/index.php","line":25,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/htdocs/lib/private/URLGenerator.php","Line":252,"message":"image not found: image:default-app-icon webroot: serverroot:/var/www/nextcloud/htdocs","exception":{},"CustomMessage":"image not found: image:default-app-icon webroot: serverroot:/var/www/nextcloud/htdocs"}}
Additional info

No response

主要语言
PHP
星标
37.2k
派生
5.3k
平均合并
2 天 13 小时
30 天内合并 PR
664

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nextcloud/server 的其他 Issue

查看 nextcloud/server 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。