Claus Ibsen created CAMEL-27792:
-----------------------------------
Summary: camel-google-storage: downloadFileName does not create
directories, copyObject does not finish the rewrite, Content-Length is stored
as metadata
Key: CAMEL-27792
URL: https://issues.apache.org/jira/browse/CAMEL-27792
Project: Camel
Issue Type: Bug
Components: camel-google-storage
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-google-storage for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31134).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The consumer does not create the directories of downloadFileName
{{GoogleCloudStorageConsumer}} calls {{blob.downloadTo(file.toPath())}}, which
ends in {{Files.newOutputStream(path)}} (google-cloud-storage 2.79.0) and
creates no parent directories. A downloadFileName directory that does not
exist, a {{${date:now:yyyyMMdd}/${file:name}}} folder, or an object name with
'/' fails with a StorageException.
Proposed change: {{Files.createDirectories(file.toPath().getParent())}} before
downloadTo.
h4. 2. copyObject does not finish the rewrite
{{GoogleCloudStorageProducer.copyObject}} returns the {{CopyWriter}} without
calling {{getResult()}}. When source and destination differ in location or
storage class, the library rewrites large objects over several calls, so the
copy is only finished if the route calls getResult() itself. The consumer's
move does call it.
Proposed change: call {{copyWriter.getResult()}} in the producer.
h4. 3. Content-Length is stored as custom metadata
In {{processFile}} the "Content-Length" entry stays in {{objectMetadata}} and
{{builder.setMetadata(objectMetadata)}} stores it as user metadata on the
object; the library never uses it as the upload size, and computing it may copy
the whole stream into the stream cache.
Proposed change: remove it before setMetadata, or drop the computation.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)