oscerd opened a new pull request, #2966:
URL: https://github.com/apache/camel-kamelets/pull/2966

   Fixes #2952
   
   `ftp-sink`, `ftps-sink`, `sftp-sink` and `azure-storage-files-sink` copied 
the inbound `file` / `ce-file` header into `CamelFileName` verbatim. A value 
carrying path separators resolved relative to the configured `directoryName` 
rather than staying inside it.
   
   ```diff
   - simple: "${header[file]}"
   + simple: "${header.file.replaceAll('^.*[/\\\\]', '').replaceAll('^\\.+$', 
'')}"
   ```
   
   The expression drops any directory component and discards a value made up 
only of dots, so the result is always a single segment inside the configured 
directory. This mirrors `http-sink`'s existing `removeHeader: CamelHttpUri` 
discipline.
   
   ### Behaviour verified against a running route
   
   Exercised with `camel run` on Camel 4.21 rather than reasoned about:
   
   | input | result |
   |---|---|
   | `../../home/u/.ssh/authorized_keys` | `authorized_keys` |
   | `..\..\win\evil.txt` | `evil.txt` |
   | `/etc/passwd` | `passwd` |
   | `a/b/` | *(empty — default naming applies)* |
   | `..` | *(empty — default naming applies)* |
   | `report.csv` | `report.csv` (unchanged) |
   | `.hidden` | `.hidden` (dotfiles preserved) |
   
   Both accessor forms were tested: `${header.file...}` and 
`${header['ce-file']...}` (the `ce-file` name needs the bracket form, and 
chained method calls work through it).
   
   ### Behaviour change
   
   A header that previously placed a file in a subdirectory — e.g. 
`reports/2026/data.csv` — now writes `data.csv` into the configured directory 
instead. If per-message subdirectories are a use case anyone relies on, that 
deserves an explicit, declared property rather than this header.
   
   ### Docs
   
   The header was documented in the `ftp-sink`, `ftps-sink` and 
`azure-storage-files-sink` partials but **not** in `sftp-sink`'s. All four now 
describe the contract, and `sftp-sink` gains the missing *Optional Headers* 
section. (The header is still not declared in `spec.definition` for any of the 
four — that is the broader #929 problem.)
   
   ### Verification
   
   - `script/validator` reports no errors
   - `mvn verify` passes
   - Sanitization behaviour verified with `camel run` as tabulated above
   
   ---
   _Claude Code on behalf of Andrea Cosentino_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to