You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/07/19 16:28:13 UTC

[camel] branch camel-3.14.x updated: CAMEL-19615 chmodDirectory option try for each junk to change the directory permission and fails (#10730)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.14.x by this push:
     new e8b5b37d724 CAMEL-19615 chmodDirectory option try for each junk to change the directory permission and fails (#10730)
e8b5b37d724 is described below

commit e8b5b37d7240db2fce8411d5769233bf8065ff0b
Author: Michael R <mi...@rambichler.at>
AuthorDate: Wed Jul 19 18:27:01 2023 +0200

    CAMEL-19615 chmodDirectory option try for each junk to change the directory permission and fails (#10730)
    
    Co-authored-by: at00191173 <mi...@spar-ics.com>
---
 .../apache/camel/component/file/remote/SftpOperations.java   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
index 392ed8cf45b..9078bd3d345 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
@@ -572,8 +572,10 @@ public class SftpOperations implements RemoteFileOperations<SftpRemoteFile> {
                     success = buildDirectoryChunks(directory);
                 }
 
-                // after creating directory, we may set chmod on the file
-                chmodOfDirectory(directory);
+                // only after successfully creating directory, we may set chmod on the file
+                if (success) {
+                    chmodOfDirectory(directory);
+                }
             }
         } catch (SftpException e) {
             throw new GenericFileOperationFailedException("Cannot build directory: " + directory, e);
@@ -614,8 +616,10 @@ public class SftpOperations implements RemoteFileOperations<SftpRemoteFile> {
                     // ignore keep trying to create the rest of the path
                 }
 
-                // after creating directory, we may set chmod on the file
-                chmodOfDirectory(directory);
+                // only after successfully creating directory, we may set chmod on the file
+                if (success) {
+                    chmodOfDirectory(directory);
+                }
             }
         }