custom-components / grocy

Custom Grocy integration for Home Assistant
Apache License 2.0
153 stars 45 forks source link

Large PDFs to equipment causing errors #287

Open KyleStilkey opened 10 months ago

KyleStilkey commented 10 months ago

Describe the bug Large PDF files causing errors when uploading to equipment

Expected behavior It should upload and or if a limit is in place, it should just notify the user the files to large and to try compressing/reducing the file size.

To Reproduce Create a new equipment or edit a current one. Add this PDF to the equipment.

Attach this PDF.

General information to help debugging:

{"error_message":"File not found","error_details":{"stack_trace":"#0 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/Handlers\/Strategies\/RequestResponse.php(38): Grocy\Controllers\FilesApiController->ServeFile()\n#1 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/Routing\/Route.php(358): Slim\Handlers\Strategies\RequestResponse->invoke()\n#2 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(65): Slim\Routing\Route->handle()\n#3 \/var\/www\/grocy\/middleware\/JsonMiddleware.php(13): Slim\MiddlewareDispatcher->handle()\n#4 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(168): Grocy\Middleware\JsonMiddleware->invoke()\n#5 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(65): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()\n#6 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/Routing\/Route.php(315): Slim\MiddlewareDispatcher->handle()\n#7 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/Routing\/RouteRunner.php(68): Slim\Routing\Route->run()\n#8 \/var\/www\/grocy\/middleware\/LocaleMiddleware.php(16): Slim\Routing\RouteRunner->handle()\n#9 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Grocy\Middleware\LocaleMiddleware->invoke()\n#10 \/var\/www\/grocy\/middleware\/AuthMiddleware.php(76): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()\n#11 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Grocy\Middleware\AuthMiddleware->invoke()\n#12 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/Middleware\/RoutingMiddleware.php(45): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()\n#13 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(121): Slim\Middleware\RoutingMiddleware->process()\n#14 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/Middleware\/ErrorMiddleware.php(76): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()\n#15 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(121): Slim\Middleware\ErrorMiddleware->process()\n#16 \/var\/www\/grocy\/middleware\/CorsMiddleware.php(30): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()\n#17 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Grocy\Middleware\CorsMiddleware->__invoke()\n#18 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/MiddlewareDispatcher.php(65): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()\n#19 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/App.php(199): Slim\MiddlewareDispatcher->handle()\n#20 \/var\/www\/grocy\/vendor\/slim\/slim\/Slim\/App.php(183): Slim\App->handle()\n#21 \/var\/www\/grocy\/app.php(106): Slim\App->run()\n#22 \/var\/www\/grocy\/public\/index.php(45): require_once('...')\n#23 {main}","file":"\/var\/www\/grocy\/controllers\/FilesApiController.php","line":64}}

"\r\n\r\n\r\n

413 Request Entity Too Large \r\n nginx \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"

What is your installed versions of Home Assistant, Grocy and this integration?

2023.8.3

How do you have Grocy installed? Add-on or external?

Add-on

Additional context

This looks to be due to file size, it was 27MBs which isn't normal but I reduced the file with a compressor and it works just fine now. I think what should happen if there is a file limit is it should just notify the user the files too large vs what's happening now.

https://www.isdt.co/down/pdf/N8%20Manual.pdf

Here is a link to the manual used by the manufacturer it's too large for me to upload here too.

Gtasian commented 8 months ago

I believe this is an error from the grocy add-on. (this is the integrations page.) Anyway, you should be able to upload them on your local address.