cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Check operations for correct exception handling

Open tomsik-radek opened this issue 1 year ago • 3 comments

Description After adding a recipe in the "Instructions" section, the user can't open Cookbook. Both on web and in the mobile app

Reproduction Steps to reproduce the behavior:

  1. Create recipe with instructions being over 500 characters or so
  2. Refresh page
  3. Go to Cookbook
  4. See error Internal Server Error (500 on mobile app)

Expected behavior Cookbook loads

Actual behavior

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1

    /app/www/public/3rdparty/doctrine/dbal/src/Connection.php - line 1814:

    Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert()

    /app/www/public/3rdparty/doctrine/dbal/src/Connection.php - line 1749:

    Doctrine\DBAL\Connection->handleDriverException()

    /app/www/public/3rdparty/doctrine/dbal/src/Connection.php - line 1163:

    Doctrine\DBAL\Connection->convertExceptionDuringQuery()

    /app/www/public/lib/private/DB/Connection.php - line 295:

    Doctrine\DBAL\Connection->executeStatement()

    /app/www/public/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php - line 354:

    OC\DB\Connection->executeStatement()

    /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php - line 280:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /config/www/nextcloud/apps/cookbook/lib/Db/RecipeDb.php - line 518:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 256:

    OCA\Cookbook\Db\RecipeDb->insertRecipes()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 105:

    OCA\Cookbook\Service\DbCacheService->applyDbReceipeChanges()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 72:

    OCA\Cookbook\Service\DbCacheService->carryOutUpdate()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 406:

    OCA\Cookbook\Service\DbCacheService->updateCache("*** sensiti ... *")

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 395:

    OCA\Cookbook\Service\DbCacheService->checkSearchIndexUpdate()

    /config/www/nextcloud/apps/cookbook/lib/Controller/MainController.php - line 56:

    OCA\Cookbook\Service\DbCacheService->triggerCheck()

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.php - line 230:

    OCA\Cookbook\Controller\MainController->index()

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.php - line 137:

    OC\AppFramework\Http\Dispatcher->executeController()

    /app/www/public/lib/private/AppFramework/App.php - line 183:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /app/www/public/lib/private/Route/Router.php - line 315:

    OC\AppFramework\App::main()

    /app/www/public/lib/base.php - line 1068:

    OC\Route\Router->match()

    /app/www/public/index.php - line 36:

    OC::handleRequest()

Caused by Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1

    /app/www/public/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php - line 103:

    Doctrine\DBAL\Driver\PDO\Exception::new()

    /app/www/public/3rdparty/doctrine/dbal/src/Connection.php - line 1153:

    Doctrine\DBAL\Driver\PDO\Statement->execute()

    /app/www/public/lib/private/DB/Connection.php - line 295:

    Doctrine\DBAL\Connection->executeStatement()

    /app/www/public/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php - line 354:

    OC\DB\Connection->executeStatement()

    /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php - line 280:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /config/www/nextcloud/apps/cookbook/lib/Db/RecipeDb.php - line 518:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 256:

    OCA\Cookbook\Db\RecipeDb->insertRecipes()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 105:

    OCA\Cookbook\Service\DbCacheService->applyDbReceipeChanges()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 72:

    OCA\Cookbook\Service\DbCacheService->carryOutUpdate()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 406:

    OCA\Cookbook\Service\DbCacheService->updateCache("*** sensiti ... *")

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 395:

    OCA\Cookbook\Service\DbCacheService->checkSearchIndexUpdate()

    /config/www/nextcloud/apps/cookbook/lib/Controller/MainController.php - line 56:

    OCA\Cookbook\Service\DbCacheService->triggerCheck()

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.php - line 230:

    OCA\Cookbook\Controller\MainController->index()

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.php - line 137:

    OC\AppFramework\Http\Dispatcher->executeController()

    /app/www/public/lib/private/AppFramework/App.php - line 183:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /app/www/public/lib/private/Route/Router.php - line 315:

    OC\AppFramework\App::main()

    /app/www/public/lib/base.php - line 1068:

    OC\Route\Router->match()

    /app/www/public/index.php - line 36:

    OC::handleRequest()

Caused by PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1

    /app/www/public/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php - line 101:

    PDOStatement->execute()

    /app/www/public/3rdparty/doctrine/dbal/src/Connection.php - line 1153:

    Doctrine\DBAL\Driver\PDO\Statement->execute()

    /app/www/public/lib/private/DB/Connection.php - line 295:

    Doctrine\DBAL\Connection->executeStatement()

    /app/www/public/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php - line 354:

    OC\DB\Connection->executeStatement()

    /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php - line 280:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /config/www/nextcloud/apps/cookbook/lib/Db/RecipeDb.php - line 518:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 256:

    OCA\Cookbook\Db\RecipeDb->insertRecipes()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 105:

    OCA\Cookbook\Service\DbCacheService->applyDbReceipeChanges()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 72:

    OCA\Cookbook\Service\DbCacheService->carryOutUpdate()

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 406:

    OCA\Cookbook\Service\DbCacheService->updateCache("*** sensiti ... *")

    /config/www/nextcloud/apps/cookbook/lib/Service/DbCacheService.php - line 395:

    OCA\Cookbook\Service\DbCacheService->checkSearchIndexUpdate()

    /config/www/nextcloud/apps/cookbook/lib/Controller/MainController.php - line 56:

    OCA\Cookbook\Service\DbCacheService->triggerCheck()

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.php - line 230:

    OCA\Cookbook\Controller\MainController->index()

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.php - line 137:

    OC\AppFramework\Http\Dispatcher->executeController()

    /app/www/public/lib/private/AppFramework/App.php - line 183:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /app/www/public/lib/private/Route/Router.php - line 315:

    OC\AppFramework\App::main()

    /app/www/public/lib/base.php - line 1068:

    OC\Route\Router->match()

    /app/www/public/index.php - line 36:

    OC::handleRequest()

Screenshots image

Browser Firefox 121, happens in Chromium 120 too

Versions Nextcloud server version: linuxserver/nextcloud:27.1.2 Cookbook version: 0.10.5 Database system: MariaDB mariadb:10.6

Yes I see the error message shows "Column Name", but my name was only like 20 characters long.

tomsik-radek avatar Dec 27 '23 16:12 tomsik-radek

Would you mind sharing the corresponding JSON file of it exists already on the Nextcloud server?

christianlupus avatar Dec 27 '23 17:12 christianlupus

Hmm, it seems like I did accidentally paste the recipe into the name, resulting in a 325 character title. Also weird, the folder is in User/Recipes but only in the WebUI, not in the Windows app

Here is the json recipe.json

Would it be possible to replace the error message (either the one given to user or the one in Admin Log) with something more useful? Maybe "try deleting files from your /Recipes folder", or show the .json that is the issue in the Admin log next to the stack trace?

tomsik-radek avatar Dec 27 '23 17:12 tomsik-radek

This is mainly a duplicate of #1620.

The folder is most probably not visible in Windows as Win has a rather hard limit on the path length. I ran into similar issues as well (with deep nested folders). As your NC instance runs on Linux, a more sophisticated file system allows for longer path names.

With the fix of #1620 this error should no longer happen. Nevertheless checking for error handling might be a good idea.

christianlupus avatar Jan 04 '24 07:01 christianlupus