[ 
https://issues.apache.org/jira/browse/CAMEL-25383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-25383:
--------------------------------
    Fix Version/s: 4.23.0

> camel-support - EndpointUriFactorySupport removes an unset optional path 
> option by name from inside the value of an earlier path option
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25383
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25383
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> {{EndpointUriFactorySupport.buildPathParameter}} fills the path options one 
> at a time, in the order of the syntax. For an optional path option without a 
> value, it removes the option's name from the uri, found with 
> {{indexOfPathParameter}}. That search starts after the scheme, so it can find 
> the name inside the value of a path option already substituted, cut it out, 
> and remove one separator character before it.
> Example: the azure-files syntax is 
> {{azure-files://account/share:port/directoryName}}, with {{port}} and 
> {{directoryName}} optional. In YAML DSL:
> {noformat}
> uri: azure-files
> parameters:
>   account: "{{accountName}}"
>   share: "{{shareName}}/{{directoryName}}"
> {noformat}
> The YAML DSL builds the uri with the component's EndpointUriFactory and gets:
> {noformat}
> azure-files:{{accountName}}/{{shareName}}/{}}
> {noformat}
> After {{share}} is substituted, the unset {{directoryName}} is removed by 
> name. {{indexOfPathParameter}} finds the word inside the substituted value 
> {{{{directoryName}}}} ({{{}} counts as a word boundary), removes it and the 
> {{{}} before it, and leaves {{{}}}}. Any value that contains the name of a 
> later, unset optional path option as a word is changed the same way, with or 
> without placeholders.
> Found while normalizing the camel-kamelets catalog to canonical YAML DSL 
> (CAMEL-25381): {{azure-storage-files-source}} was written with {{share: 
> "{{shareName}}/{{directoryName}}"}}. CAMEL-25381 now keeps such a uri as 
> written, but the factory itself is still affected.
> Proposal: search for the name only in the part of the uri that is still 
> syntax. Path options are filled in syntax order, so it is enough to start 
> after the end of the last value substituted, or to build the path from the 
> syntax in one pass instead of replacing names in a string that already holds 
> values. A test in camel-support can use a small factory with a syntax such as 
> {{foo:a/b:c/d}} where {{c}} and {{d}} are optional, and the value of {{b}} 
> contains {{d}}.



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

Reply via email to