yuseok89 commented on code in PR #77514:
URL: https://github.com/apache/airflow/pull/77514#discussion_r4682233228


##########
providers/amazon/src/airflow/providers/amazon/aws/transfers/s3_to_sftp.py:
##########
@@ -149,7 +149,19 @@ def execute(self, context: Context) -> None:
             if isinstance(self.s3_filenames, str):
                 self.log.info("Getting files in s3://%s/%s", self.s3_bucket, 
self.s3_key)
                 all_keys = s3_hook.list_keys(bucket_name=self.s3_bucket, 
prefix=self.s3_key) or []
-                filenames = [k[len(self.s3_key) :] for k in all_keys]
+                # A key ending in "/" is a folder marker, such as the S3 
console creates for each
+                # folder. An SFTP server cannot store a file at a path ending 
in "/", so skip every
+                # marker, not only those that overlap other keys as the 
object-store transfers do.
+                folder_markers = [k for k in all_keys if k.endswith("/")]

Review Comment:
   Thanks for taking this into account! I ran it on my side with a real S3 
bucket and local SFTP and FTP servers, and it works well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to