You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/01 11:41:30 UTC

[GitHub] [airflow] gitstart-airflow commented on a diff in pull request #24039: Fix GCSToGCSOperator cannot copy a single file/folder without copying other files/folders with that prefix

gitstart-airflow commented on code in PR #24039:
URL: https://github.com/apache/airflow/pull/24039#discussion_r886705126


##########
airflow/providers/google/cloud/transfers/gcs_to_gcs.py:
##########
@@ -341,6 +345,8 @@ def _copy_source_without_wildcard(self, hook, prefix):
                 raise AirflowException(msg)
 
         for source_obj in objects:
+            if self.exact_match and (source_obj != prefix or not source_obj.endswith(prefix)):
+                continue

Review Comment:
   @uranusjr That's the issue. According to this issue #22675 , treating these objects as prefix copies objects from the source bucket that has no match with the specified ```source_object```. So, checking ```not source_obj.endswith(prefix)``` makes sure we only copy the exact match and not copying all objects with the same prefix as the ```source_objext```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org