allthingssecurity commented on PR #28430:
URL: https://github.com/apache/camel/pull/28430#issuecomment-6395121337

   @davsclaus thanks for the review. Changes are in c846194f4c04.
   
   1. **[Important] `WrappedFile` with a one-shot stream**: fixed as you 
suggested. `prepareChecksum` now looks at the content of a `WrappedFile` before 
it picks the stream-cache branch. A `RemoteFile` whose body is the download 
stream gets the one-pass `DigestInputStream` on the wrapped stream and is no 
longer copied into a `StreamCache`. The new 
`testChecksumOfRemoteFileStreamIsCalculatedWhileUploading` sends a 
`RemoteFile<FTPFile>` whose body is a non-markable stream. It checks the 
uploaded bytes, the checksum file, and that the body after the producer is not 
a `StreamCache`. On the previous head it fails with `the download stream was 
cached: class org.apache.camel.converter.stream.ByteArrayInputStreamCache`.
   2. **mark/reset**: applied. The digest stream is now a small 
`DigestInputStream` subclass: `markSupported()` returns `false`, `mark` does 
nothing and `reset` throws `IOException`. The same test checks 
`markSupported()`.
   3. **Stale header with an eager kept target**: applied. When 
`checksumFileAlgorithm` is set, the header is removed at the start of 
`processExchange`, before the `handleExistingTargetEager` return. The new 
`testNoEarlierChecksumHeaderWhenTheExistingFileIsKeptEagerly` (`tempFileName`, 
`fileExist=Ignore`, default `eagerDeleteTargetFile`, existing target, incoming 
`CamelFileChecksum`) fails on the previous head with `expected: <null> but was: 
<stale>`.
   4. **`allowNullBody`**: I made the remote producers follow the file 
producer, so an empty file from `allowNullBody` gets no checksum file and no 
header. This keeps `FileOperations` unchanged. The new 
`testNoChecksumOfNullBody` fails on the previous head (`No checksum file`). I 
also added the comment on the `existsFile` check: the file can only exist there 
when there is no temp file name.
   5. **scp / azure-files with `charset`**: not in this PR. The upgrade note 
says not to combine them. A WARN at producer start, or rejecting the 
combination, would touch two more components that I cannot test here, so I 
would rather do it in a follow-up. Tell me if you want it in this PR instead.
   
   Nit: you are right, the camel-file PR is #28429 (CAMEL-25905). I have 
prepared the fix for the description.
   
   Tests on this head: camel-file 28 and camel-ftp `*Test` plus 
`FtpProducer*IT` (embedded FTP server) 159 run, 0 failures, 12 skipped. 
`FtpProducerChecksumFileAlgorithmIT` now has 10 tests. Not run: smb, 
azure-files, scp and mina-sftp.
   
   _Claude Code on behalf of allthingssecurity_
   


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