pavansai1997 opened a new pull request, #76665:
URL: https://github.com/apache/airflow/pull/76665

   `FTPHook.get_size` returns `None` for an empty file. `ftplib.FTP.size()` 
returns the size as an `int` when the server answers `213` and `None` 
otherwise, so a 0-byte file comes back as `0`, which the truthiness check in 
`get_size` turned into `None`. `None` is what the hook returns when the server 
gives no size, so callers could not tell an empty file from a missing size.
   
   The check is now `is not None`. `test_get_size` only checked that `SIZE` was 
sent; it now asserts the returned value for a file, an empty file and no size 
reply, and the empty-file case fails without the change.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Code Puppy
   
   Generated-by: Code Puppy following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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