jroachgolf84 commented on code in PR #51167: URL: https://github.com/apache/airflow/pull/51167#discussion_r2114722805
########## providers/sftp/src/airflow/providers/sftp/sensors/sftp.py: ########## @@ -96,8 +96,9 @@ def poke(self, context: Context) -> PokeReturnValue | bool: 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 + # to return True, even if the file was not present + actual_files_to_check = [self.path] if self.hook.isfile(self.path) else [] except OSError as e: if e.errno != SFTP_NO_SUCH_FILE: Review Comment: Yes, `.isfile` can only raise an OSError. You can find this in this code snippet. https://github.com/apache/airflow/blob/1439e1f07eb17652e53bafc3b3c85f4dac5593f9/providers/sftp/src/airflow/providers/sftp/hooks/sftp.py#L220-L230 -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org