From 974bb85fb7406a1552a1e44f05a3b1685133ce27 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 6 Feb 2025 12:55:27 +0200 Subject: [PATCH] rescue malformed PDF --- app/controllers/api/tools_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/api/tools_controller.rb b/app/controllers/api/tools_controller.rb index 7b2d5cb4..63a50f89 100644 --- a/app/controllers/api/tools_controller.rb +++ b/app/controllers/api/tools_controller.rb @@ -34,6 +34,8 @@ module Api } end } + rescue HexaPDF::MalformedPDFError + render json: { error: 'Malformed PDF' }, status: :unprocessable_entity end end end