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

   `FTPHook.get_conn()` and `FTPSHook.get_conn()` pass the `passive` connection 
extra straight to `ftplib.FTP.set_pasv()`. If the value is a string, every 
non-empty value is truthy, so `"false"` leaves passive mode on and active mode 
can't be selected. The hook docstring shows the extra as a string (`{"passive": 
"true"}`), and URI-style connections store it as a string where query values 
aren't JSON-decoded. For example, the documented 
`AIRFLOW_CONN_FTP_DEFAULT='ftp://user:pass@localhost?passive=false'` on Airflow 
2.11, which the provider still supports.
   
   This PR adds a small helper that turns string values (`"false"`, `"0"`, 
`"no"`, `"off"`, case-insensitive) into a boolean and passes booleans through 
unchanged. Both hooks use it. The default is still passive mode.
   
   Tests: new parametrized `test_ftp_mode_from_string_extra` and 
`test_ftps_mode_from_string_extra` for `{"passive": "false"}` and `{"passive": 
"true"}`. Before the fix they fail with `Expected: set_pasv(False)` / `Actual: 
set_pasv('false')`. With the fix, the whole FTP provider unit suite passes (61 
passed).
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code 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