nextcloud / tables

🍱 Nextcloud tables app
https://apps.nextcloud.com/apps/tables
GNU Affero General Public License v3.0
133 stars 21 forks source link

fix: insert context startpage for proper update #1146

Closed enjeck closed 1 week ago

enjeck commented 1 week ago

There's a bug with updating context. To reproduce:

Error Trace ```json "OCA\\Tables\\Controller\\ContextController", "update", [ "OC\\AppFramework\\DependencyInjection\\DIContainer" ], [ "1", "ocs.tables.context.update" ] ] }, { "file":"/var/www/html/ocs/v1.php", "line":43, "function":"match", "class":"OC\\Route\\Router", "type":"->", "args":[ "/ocsapp/apps/tables/api/2/contexts/1" ] }, { "file":"/var/www/html/ocs/v2.php", "line":7, "args":[ "/var/www/html/ocs/v1.php" ], "function":"require_once" } ], "File":"/var/www/html/apps/tables/lib/Db/PageContentMapper.php", "Line":37 }, "message":"OCA\\Tables\\Db\\PageContentMapper::findByPageAndNodeRelation(): Argument #1 ($pageId) must be of type int, null given, called in /var/www/html/apps/tables/lib/Service/ContextService.php on line 365 in file '/var/www/html/apps/tables/lib/Db/PageContentMapper.php' line 37", "exception":{ }, "CustomMessage":"OCA\\Tables\\Db\\PageContentMapper::findByPageAndNodeRelation(): Argument #1 ($pageId) must be of type int, null given, called in /var/www/html/apps/tables/lib/Service/ContextService.php on line 365 in file '/var/www/html/apps/tables/lib/Db/PageContentMapper.php' line 37" } } ```

The problem occured because there's no startpage inserted when an "empty" context without resources is created.

enjeck commented 1 week ago

An error comes up when a new context without any resources is created

foreach() argument must be of type array|object, null given at /var/www/html/apps/tables/lib/Service/ContextService.php#433"