Steps to reproduce:
Expected behavior:
The note is correctly created without any errors.
Actual behaviour:
It happens nothing. The Nextcloud logs report an internal server error:
ArgumentCountError: Too few arguments to function OC\Files\Storage\Wrapper\Encryption::file_put_contents(), 1 passed in /share/MD0_DATA/htdocs/owncloud/lib/private/Files/View.php on line 1124 and exactly 2 expected
/share/MD0_DATA/htdocs/owncloud/lib/private/Files/View.php - line 1124: OC\Files\Storage\Wrapper\Encryption->file_put_contents('files/Notes/Neu...')
/share/MD0_DATA/htdocs/owncloud/lib/private/Files/View.php - line 676: OC\Files\View->basicOperation('file_put_conten...', '/Ben/files/Note...', Array, NULL)
/share/MD0_DATA/htdocs/owncloud/lib/private/Files/Node/File.php - line 54: OC\Files\View->file_put_contents('/Ben/files/Note...', NULL)
/share/MD0_DATA/htdocs/owncloud/apps/notes/service/notesservice.php - line 152: OC\Files\Node\File->putContent(NULL)
/share/MD0_DATA/htdocs/owncloud/apps/notes/controller/notescontroller.php - line 88: OCA\Notes\Service\NotesService->update(22351, NULL, 'Ben')
[internal function] OCA\Notes\Controller\NotesController->create(NULL)
/share/MD0_DATA/htdocs/owncloud/lib/private/AppFramework/Http/Dispatcher.php - line 160: call_user_func_array(Array, Array)
/share/MD0_DATA/htdocs/owncloud/lib/private/AppFramework/Http/Dispatcher.php - line 90: OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Notes\Controller\NotesController), 'create')
/share/MD0_DATA/htdocs/owncloud/lib/private/AppFramework/App.php - line 114: OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Notes\Controller\NotesController), 'create')
/share/MD0_DATA/htdocs/owncloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main('OCA\\Notes\\Contr...', 'create', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
[internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
/share/MD0_DATA/htdocs/owncloud/lib/private/Route/Router.php - line 299: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
/share/MD0_DATA/htdocs/owncloud/lib/base.php - line 1010: OC\Route\Router->match('/apps/notes/not...')
/share/MD0_DATA/htdocs/owncloud/index.php - line 40: OC handleRequest()
{main}
Enabled apps:
Calendar 1.5.0
Contacts 1.5.2
Notes 2.2.0
PHP-Version: 7.1.1
OS: Embedded QNAP-Linux
https://github.com/nextcloud/notes/blob/v2.2.0/controller/notescontroller.php#L85
Here you can replace
public function create($content) {
$note = $this->notesService->create($this->userId);
to
public function create($content) {
if ($content===null) $content='';
$note = $this->notesService->create($this->userId);
Hmmm. @BenS89 Did the hotfix from @Loki3000 solves your issue? If yes, we should create a pull request for this. It seems, that create is called without sending content from JavaScript (see https://github.com/nextcloud/notes/blob/6aa596ed6b9a3eacfd53922e73e606d8862c0c02/templates/main.php#L45 and https://github.com/nextcloud/notes/blob/6aa596ed6b9a3eacfd53922e73e606d8862c0c02/js/app/controllers/notescontroller.js#L23).
However, I'm wondering why this is no problem for the majority of us.
I think this can be reproduced on the demo install of nextcloud
https://demo.nextcloud.com/
@korelstar The fix from @Loki3000 works for me, too.
But isn't the actual issue that create is called with null as argument in the first place?
Please try also my Pull Request #86. This is the easiest fix for the problem.
@korelstar your Pull Request #86 also fixes the issue.
Hi, I have the same error now with:
[webdav] Fatal: Sabre\DAV\Exception\ServiceUnavailable: ArgumentCountError: Too few arguments to function OCP\Files\ForbiddenException::__construct(), 1 passed in /var/www/html/lib/private/Files/Storage/DAV.php on line 857 and at least 2 expected at <<closure>>
0. <<closure>>
{closure}("*** sensitive parameters replaced ***")
1. /var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
call_user_func_array(Closure {}, ["*** sensitive ... "])
2. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 466
Sabre\Event\EventEmitter->emit("beforeMethod", ["*** sensitive ... "])
3. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 254
Sabre\DAV\Server->invokeMethod("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***")
4. /var/www/html/remote.php line 74
Sabre\DAV\Server->exec()
5. /var/www/html/remote.php line 170
handleException(ArgumentCountError {})
PROPFIND /remote.php/dav/files/<USER>/
from 95.91.214.236 by <USER> at 2020-02-14T10:56:08+00:00
In your nextcloud, go to Men眉 -> Settings -> Administration/ Overview and see this:

Looks like your setup is broken (see warning in "Overview settings"). This should be fixed before using the notes app.
Most helpful comment
I think this can be reproduced on the demo install of nextcloud
https://demo.nextcloud.com/