From 43feb722598c03a667891b8d20439b45e3d6c861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Mon, 12 May 2025 17:29:28 +0200 Subject: [PATCH 1/2] :bug: fix bad option in CLI --- bin/mindee.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mindee.rb b/bin/mindee.rb index e14db930..6c303ef1 100755 --- a/bin/mindee.rb +++ b/bin/mindee.rb @@ -99,7 +99,7 @@ def custom_subcommand(cli_parser, options) end if options[:cut_pages].nil? || !options[:cut_pages].is_a?(Integer) || options[:cut_pages] < 0 - page_options = options[:cut_pages].nil? + page_options = nil else page_options = Mindee::PageOptions.new(params: { page_indexes: (0..options[:cut_pages].to_i).to_a, From c7fd3ccdc56c01e2fa92c2bea44b2332cbb15a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Tue, 13 May 2025 09:53:51 +0200 Subject: [PATCH 2/2] :bug: don't open the PDF unless needed --- lib/mindee/client.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/mindee/client.rb b/lib/mindee/client.rb index 1ea903f5..07f62a9e 100644 --- a/lib/mindee/client.rb +++ b/lib/mindee/client.rb @@ -323,8 +323,7 @@ def enqueue_and_parse(input_source, product_class, endpoint, options) def execute_workflow(input_source, workflow_id, options: {}) opts = options.is_a?(WorkflowOptions) ? options : WorkflowOptions.new(params: options) if opts.respond_to?(:page_options) && input_source.is_a?(Input::Source::LocalInputSource) - process_pdf_if_required(input_source, - opts) + process_pdf_if_required(input_source, opts) end workflow_endpoint = Mindee::HTTP::WorkflowEndpoint.new(workflow_id, api_key: @api_key) @@ -496,7 +495,7 @@ def normalize_parse_options(options) # @param opts [ParseOptions] def process_pdf_if_required(input_source, opts) return unless input_source.is_a?(Mindee::Input::Source::LocalInputSource) && - opts.page_options && + opts.page_options.on_min_pages && input_source.pdf? input_source.process_pdf(opts.page_options)