Claus Ibsen created CAMEL-27810:
-----------------------------------

             Summary: camel-dropbox: get fails on a folder with subfolders, a 
file is downloaded twice, put of a relative folder garbles the remote paths
                 Key: CAMEL-27810
                 URL: https://issues.apache.org/jira/browse/CAMEL-27810
             Project: Camel
          Issue Type: Bug
          Components: camel-dropbox
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-dropbox for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31139).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. get fails on a folder with a subfolder
For a folder, {{DropboxAPIFacade.get}} downloads each entry of the listing; a 
subfolder entry is passed to the file download, and the DownloadErrorException 
fails the whole get.
Proposed change: skip folder entries, or recurse into them.

h4. 2. A single file is downloaded twice
For a remotePath that is a file, the get downloads the file content twice.
Proposed change: download it once.

h4. 3. put of a relative localPath gives garbled remote paths
{{DropboxAPIFacade.putFile}} builds the remote path of each file of a folder 
from {{localPath.length()}}, which does not match the absolute paths that 
FileUtils.listFiles returns for a relative localPath.
Proposed change: relativize with Path.relativize on normalized paths.

h4. 4. The remote path header has whitespace replaced with +
CamelDropboxRemotePath is URL-encoded on its way to the SDK, so a space becomes 
+ in the Dropbox path.
Proposed change: pass the path as is.

h4. 5. search without a query fails with IllegalArgumentException
With no query (option or header) the search operation passes null to the SDK, 
which throws IllegalArgumentException.
Proposed change: validate at endpoint creation with a clear message, or list 
the folder.

h4. 6. Consumers never validate remotePath
The search and get consumers do not validate remotePath, which gives a 
NullPointerException, or a search over the whole Dropbox.
Proposed change: validate remotePath when the consumer is created.

h4. 7. putFile returns null for a special file
For a path that is neither a file nor a directory, putFile returns null and the 
producer fails with a NullPointerException.
Proposed change: throw a DropboxException with the path.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to