This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-4.0.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.0.x by this push: new d46c62c375d CAMEL-20209: leverage Azure Files overwrite feature (#12377) d46c62c375d is described below commit d46c62c375d2bdd9313da524890454f5afc93f47 Author: pekuz <petrku...@eurofins.com> AuthorDate: Fri Dec 8 16:36:10 2023 +0100 CAMEL-20209: leverage Azure Files overwrite feature (#12377) * CAMEL-19822: must not ensure relative because target expects absolute * CAMEL-20209: leverage Azure Files feature it could be further optimized, e.g. removing the prior remove attempt but it's easier to reuse Camel base classes --- .../java/org/apache/camel/component/file/azure/FilesOperations.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesOperations.java b/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesOperations.java index da39a382ea9..6e9828742b0 100644 --- a/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesOperations.java +++ b/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesOperations.java @@ -181,8 +181,10 @@ public class FilesOperations extends NormalizedOperations { } private boolean renameRemote(ShareFileClient fileClient, String shareRelativeTo) { - // TODO set the replace flag? likely yes, callers strategy should avoid this call when otherwise var options = new ShareFileRenameOptions(shareRelativeTo); + // known strategies try to remove an existing target file before calling rename + // but it is neither atomic nor sure so instruct Azure Files to overwrite the file + options.setReplaceIfExists(Boolean.TRUE); var renamed = fileClient.renameWithResponse(options, endpoint.getMetadataTimeout(), Context.NONE).getValue(); return existsRemote(renamed); }