Andrea Cosentino created CAMEL-24894:
----------------------------------------

             Summary: camel-docling: make output path handling consistent with 
input path and custom-argument handling
                 Key: CAMEL-24894
                 URL: https://issues.apache.org/jira/browse/CAMEL-24894
             Project: Camel
          Issue Type: Improvement
          Components: camel-docling
            Reporter: Andrea Cosentino


DoclingProducer handles the path-bearing values it forwards to the docling CLI 
inconsistently:

* Input file paths (header/body) are normalized and, when 
{{inputBaseDirectory}} is configured, confined to that directory 
({{resolveWithinInputBaseDirectory}}).
* Custom CLI argument values are normalized and checked via 
{{validatePathSafety}}.
* The {{CamelDoclingOutputFilePath}} header, however, is passed straight to the 
{{--output}} flag in {{addOutputDirectoryArguments}} with no normalization and 
no containment option.

There is also no {{outputBaseDirectory}} counterpart to {{inputBaseDirectory}}, 
so a deployment cannot confine where conversion output is written even when it 
wants to.

h3. Proposed change

* Add an optional {{outputBaseDirectory}} endpoint option mirroring 
{{inputBaseDirectory}}.
* In {{addOutputDirectoryArguments}}, normalize the 
{{CamelDoclingOutputFilePath}} value and, when {{outputBaseDirectory}} is set, 
confine it to that directory (reject values resolving outside) - consistent 
with input-path handling.
* Apply the same path-safety normalization already used for custom-argument 
values.
* Document the new option/behavior in the component docs and the 4.23 upgrade 
guide.
* Add a unit test covering normalization and containment of the output path.

Affected: {{DoclingProducer.addOutputDirectoryArguments}}, 
{{DoclingConfiguration}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to