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 a15cc090b47 CAMEL-19822: must not ensure relative because target 
expects absolute (#11272)
a15cc090b47 is described below

commit a15cc090b47067bda97c15b32f962041ad3e0069
Author: pekuz <petrku...@eurofins.com>
AuthorDate: Fri Sep 1 17:58:23 2023 +0200

    CAMEL-19822: must not ensure relative because target expects absolute 
(#11272)
---
 .../org/apache/camel/component/file/azure/FilesOperations.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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 a40bed35da6..da39a382ea9 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
@@ -174,14 +174,14 @@ public class FilesOperations extends NormalizedOperations 
{
         log.trace("renameFile({}, {})", from, to);
 
         try {
-            return renameRemote(getFileClient(FilesPath.ensureRelative(from)), 
FilesPath.ensureRelative(to));
+            return renameRemote(getFileClient(from), 
FilesPath.ensureRelative(to));
         } catch (RuntimeException e) {
             throw new GenericFileOperationFailedException("Cannot rename: " + 
from + " to: " + to, e);
         }
     }
 
     private boolean renameRemote(ShareFileClient fileClient, String 
shareRelativeTo) {
-        // TODO replace existing?
+        // TODO set the replace flag? likely yes, callers strategy should 
avoid this call when otherwise 
         var options = new ShareFileRenameOptions(shareRelativeTo);
         var renamed = fileClient.renameWithResponse(options, 
endpoint.getMetadataTimeout(), Context.NONE).getValue();
         return existsRemote(renamed);
@@ -667,8 +667,9 @@ public class FilesOperations extends NormalizedOperations {
 
     private ShareFileClient getFileClient(String path) {
 
-        assert FilesPath.isAbsolute(path);
-        assert !FilesPath.isRoot(path);
+        assert FilesPath.isAbsolute(path) : "Expecting /a_path from share 
root, got: " + path;
+        assert !FilesPath.isRoot(path) : "Expecting /a_path from share root, 
got: " + path;
+        // if we got a relative path we need to figure out its base
 
         return root.getFileClient(FilesPath.ensureRelative(path));
     }

Reply via email to