RNHTTR commented on code in PR #51167:
URL: https://github.com/apache/airflow/pull/51167#discussion_r2121220465
##########
providers/sftp/src/airflow/providers/sftp/sensors/sftp.py:
##########
@@ -89,25 +89,26 @@ def poke(self, context: Context) -> PokeReturnValue | bool:
if self.file_pattern:
files_from_pattern = self.hook.get_files_by_pattern(self.path,
self.file_pattern)
if files_from_pattern:
- actual_files_to_check = [
+ actual_files_present = [
os.path.join(self.path, file_from_pattern) for
file_from_pattern in files_from_pattern
]
else:
return False
else:
try:
- self.hook.isfile(self.path)
- actual_files_to_check = [self.path]
+ # File that did not exist was still being added to the list,
which was causing the Sensor
Review Comment:
IIUC, there's a scenario where `self.path` is a directory and not a file,
and the sensor returns `True` when it detects this file. If that's the case,
can you please make this comment a little more clear and obvious?
--
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]