davsclaus opened a new pull request, #30187:
URL: https://github.com/apache/camel/pull/30187
## Backport of #29848
Backport of #29848 (CAMEL-26925: camel-sftp - use remote file names
literally when calling JSch) onto `camel-4.18.x`.
**Original PR:** #29848 - CAMEL-26925: camel-sftp - use remote file names
literally when calling JSch
**Original author:** @davsclaus
**Target branch:** `camel-4.18.x`
**Fix version:** 4.18.6
This is an **adapted** port, not a straight cherry-pick. The squash commit
of #29848 was cherry-picked and its conflicts resolved for `camel-4.18.x`,
which does not have the single-request existence check (CAMEL-26656) or the
one-at-a-time listing (CAMEL-26635) of `main`.
### Adaptations
- `SftpOperations`: the methods that only exist on `main`
(`listFiles(String, Predicate)`, `isReentrantListing`, `getFileAttributes` and
its helpers) are left out.
- `SftpOperations.existsFile`: on this branch the existence check lists the
directory itself. It now normalizes the name with the endpoint's `separator`,
as `getFileAttributes` does on `main`, and the directory listing passes the
directory through `quotePathForJsch`.
- `SftpOperations.fastExistsFile`: on this branch it still calls
`channel.ls(name)` (on `main` it uses the single-request check), so that call
passes the name through `quotePathForJsch` too.
- `SftpFileNameWithSpecialCharactersIT`:
- It uses `camel-test-junit5` and the plain `SftpEmbeddedService`, as this
branch has neither `camel-test-junit6` nor the counting service of
`SftpExistsFileIT`.
- `tempPrefixWithBackslashInDirectoryNameWhenServerDoesNotAnswerLstat` is
renamed to `tempPrefixWithBackslashInDirectoryName` and does not need the hook
that rejects the single-request check, because on this branch the existence
check always lists the directory.
- `checksumFileOfFileWithWildcardInName` passes the checksum in the
`CamelFileChecksum` header, because on this branch the sftp producer does not
compute it. The test still covers `storeFileDirectly`.
- New `tempPrefixReplacesOnlyFileWithWildcardInName` (with
`fastExistsCheck` on and off): with `tempPrefix`, the existing target file with
`?` in its name is replaced, and another file whose name matches keeps its
content. This covers the `fastExistsFile` listing, which `main` no longer has.
- Upgrade guide: the 4.18.6 entry is already in
`camel-4x-upgrade-guide-4_18.adoc` on `main` (added by #29848), so this port
has no documentation changes.
### Tests
- `SftpFileNameWithSpecialCharactersIT`: all 26 cases pass with the change
and fail without it.
- All SFTP integration tests of camel-ftp (`Sftp*IT`, 114) and the unit
tests of camel-ftp pass. `SftpChangedReadLockIT` failed once in a second run on
the same `target` directory, then passed in two reruns. It does not use the
names this change is about.
_Claude Code on behalf of davsclaus_
🤖 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]