davsclaus opened a new pull request, #30186:
URL: https://github.com/apache/camel/pull/30186

   ## Backport of #29848
   
   Cherry-pick of #29848 (CAMEL-26925: camel-sftp - use remote file names 
literally when calling JSch) onto `camel-4.22.x`, for 4.22.3.
   
   **Original PR:** #29848 - CAMEL-26925: camel-sftp - use remote file names 
literally when calling JSch
   **Target branch:** `camel-4.22.x`
   **JIRA:** [CAMEL-26925](https://issues.apache.org/jira/browse/CAMEL-26925)
   
   ### Adapted, not a straight cherry-pick
   
   `camel-4.22.x` does not have the single-request existence check of `main` 
(`getFileAttributes`, `lstat`) nor the visitor listing `listFiles(path, 
visitor)`, so the cherry-pick needed these changes:
   
   - `SftpOperations`: kept the existing `existsFile` and `fastExistsFile` of 
this branch, and applied the change of #29848 to them: the name is normalized 
with the endpoint's `separator` at the start of `existsFile` (as 
`getFileAttributes` does on `main`), and the directory listing of `existsFile` 
and the `ls` of `fastExistsFile` pass the path through `quotePathForJsch`. The 
`listFiles(path, visitor)` hunk is dropped, as that method does not exist on 
this branch.
   - `SftpFileNameWithSpecialCharactersIT`: uses `SftpEmbeddedService` of 
camel-test-infra-ftp, as the counting server of `main` (`SftpExistsFileIT`) is 
not on this branch. 
`tempPrefixWithBackslashInDirectoryNameWhenServerDoesNotAnswerLstat` is 
`tempPrefixWithBackslashInDirectoryName` here, without the hook that refuses 
the `lstat` request, because the existence check of this branch always lists 
the directory.
   - `checksumFileOfFileWithWildcardInName` sets the `CamelFileChecksum` 
header, because on this branch the remote producer writes the checksum file 
only with the checksum given in that header.
   - New `tempPrefixReplacesOnlyFileWithWildcardInName` (with `fastExistsCheck` 
on and off): with `tempPrefix`, the existing target with a `?` in its name is 
checked and replaced, and another file whose name matches keeps its content. On 
`main` the existence check already uses the name as is, so this case only 
applies to this branch.
   - The upgrade guide entries are not part of the backport: the 4.22.3 entry 
is already in `camel-4x-upgrade-guide-4_22.adoc` on `main` (#29848), where the 
upgrade guides of all versions are kept.
   
   ### Tests
   
   - `SftpFileNameWithSpecialCharactersIT`: 26 cases pass; all 26 fail without 
the change to `SftpOperations`.
   - camel-ftp unit tests (84) and all SFTP integration tests (`Sftp*IT`, 115) 
pass.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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