[ 
https://issues.apache.org/jira/browse/CAMEL-24894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117976#comment-18117976
 ] 

Andrea Cosentino commented on CAMEL-24894:
------------------------------------------

PR opened against main: https://github.com/apache/camel/pull/26737

Backports to camel-4.22.x and camel-4.18.x are labelled for the backport bot 
and will follow once the main PR is merged.

_Claude Code on behalf of oscerd_

> 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
>            Assignee: Andrea Cosentino
>            Priority: Major
>
> 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