nextcloud / welcome

Welcome widget in Nextcloud's dashboard
GNU Affero General Public License v3.0
17 stars 11 forks source link

Call to a member function getContent() on null #35

Closed enoch85 closed 1 year ago

enoch85 commented 1 year ago

Just noticed this error in Nextcloud 26.0.1. Don't know how it's related to anything, but thought I'd shed some light on it anyway.

Nextcloud 26.0.1 PHP 8.0 Apache 2.4 MySQL 8.0.32

[index] Fel: Exception: Call to a member function getContent() on null in file '/srv/www/nextcloud/apps/welcome/lib/Service/FileService.php' line 109 at <<closure>>

0. /srv/www/nextcloud/lib/private/AppFramework/App.php line 183
   OC\AppFramework\Http\Dispatcher->dispatch()
1. /srv/www/nextcloud/lib/private/Route/Router.php line 315
   OC\AppFramework\App::main()
2. /srv/www/nextcloud/lib/base.php line 1056
   OC\Route\Router->match()
3. /srv/www/nextcloud/index.php line 36
   OC::handleRequest()

Caused by:

Error: Call to a member function getContent() on null at <<closure>>

0. /srv/www/nextcloud/apps/welcome/lib/Controller/ConfigController.php line 67
   OCA\Welcome\Service\FileService->getWidgetContent()
1. /srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 230
   OCA\Welcome\Controller\ConfigController->getWidgetContent()
2. /srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 137
   OC\AppFramework\Http\Dispatcher->executeController()
3. /srv/www/nextcloud/lib/private/AppFramework/App.php line 183
   OC\AppFramework\Http\Dispatcher->dispatch()
4. /srv/www/nextcloud/lib/private/Route/Router.php line 315
   OC\AppFramework\App::main()
5. /srv/www/nextcloud/lib/base.php line 1056
   OC\Route\Router->match()
6. /srv/www/nextcloud/index.php line 36
   OC::handleRequest()

GET /apps/welcome/widget-content
from XXXXX by danh at 2023-04-25T14:30:41+00:00
julien-nc commented 1 year ago

Thanks for the bug report. I didn't see any obvious reason for it to fail on NC 26. Works fine on my dev instances. It crashes because there was a missing check when getting the file. It still means the file is probably missing in your case.

Could you check that the selected markdown file really exists? You can get the path and the owner with

occ config:app:get welcome filePath
occ config:app:get welcome userId

or by checking the admin theming settings and then check the file is actually there in the Files app.

enoch85 commented 1 year ago

Thanks!

This is the output:

/Documents/Customer Welcome/welcome.md
admin

Checking the admin folder structure, I can't even find a folder called "Documents".

What's the way forward here?

julien-nc commented 1 year ago

I don't know what led you to this state but then I suspect it will work if you choose a markdown file again from the Welcome widget admin settings.

Maybe you just deleted or moved something.

enoch85 commented 1 year ago

OK, problem solved. File was missing.

Thanks for great help!