florianWeCG opened a new issue, #47206:
URL: https://github.com/apache/airflow/issues/47206

   ### Apache Airflow version
   
   2.10.5
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   When I connect to a Windows share using the samba provider I am receiving a 
STATUS_INVALID_PARAMETER error when I try to use the "listdir" function.
   
   This is due to the fact that in 
https://github.com/apache/airflow/blob/main/providers/samba/src/airflow/providers/samba/hooks/samba.py
 line 88 the path is created using // at the beginning and / as a separator. 
   When using the smbclient python package directly and typing backward slashes 
for joining a path, it works without any errors.
   
   
   ### What you think should happen instead?
   
   There should be a way to configure the samba provider to use backward 
slashes instead of forward slashes for joining the path.
   
   ### How to reproduce
   
   You will need a Windows computer with a network share which can be accessed 
using a username and password.
   E.g. computer name "windowsSharer", share "windowsShare", user 
"WindowsUser", ...
   The connection can then be configured in airflow.
   Create a simple dag where the SambaHook is created and the listdir function 
is called, e.g.:
   `hook = SambaHook(samba_conn_id=samba_conn_id)
   files_and_dirs = hook.listdir("windowsDirectory")
   print(f"{files_and_dirs}")`
   
   The listdir function will fail.
   However, using smbclient directly like this:
   `from smbclient import listdir, mkdir, register_session, rmdir, scandir
   from smbclient.path import isdir
   
   pathBackSlash = r"\\windowsSharer\windowsShare\windowsDirectory"
   for filename in listdir(pathBackSlash, username=r"WindowsUser@Domain", 
password="secret"):
       print(f"{filename}")
   `
   Will work, and when you change to forward slashes you get the same 
"STATUS_INVALID_PARAMETER" message like with the airflow provider.
   
   ### Operating System
   
   Ubuntu 24.04.2 LTS (in wsl)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-samba==4.9.1
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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