-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMB outbound gateway doesn't seem to support the GET command #9211
Comments
Fixes: #9211 The `AbstractRemoteFileOutboundGateway.get()` uses `Session.list()` for the provided remote file name. The `SmbSession` does not support listing for a single file. * Add logic into `SmbSession.list()` similar to `SftpSession.list()` to list a single remote file on the provided path (cherry picked from commit 91de12c)
Fixes: #9211 The `AbstractRemoteFileOutboundGateway.get()` uses `Session.list()` for the provided remote file name. The `SmbSession` does not support listing for a single file. * Add logic into `SmbSession.list()` similar to `SftpSession.list()` to list a single remote file on the provided path (cherry picked from commit 91de12c)
We just didn't have a respective test for plain Thank you for the report! |
Hi, thank you for the quick reply and fix. I have applied the fix and the problem using the SMB outbound gateway has indeed been resolved, but I now run into the issue that the behavior of the inbound channel adapter is also changed. Previously, the setup described in the sample config below worked perfectly, giving me the files in my Is this intended behavior, where the remote directory may not contain multiple directories, and 'share and dir' of the SessionFactory must point to the parent of the desired directory? That seems to be in contrast with e.g. SFTP or file inbound gateways, where the 'remote directory' field can contain multiple directories. Sample config:
|
Thank you for feedback. |
Taking that back.
And my test fails as expected:
Anyway we need a new issue for new milestone(s). |
Fixes: spring-projects#9211 The `AbstractRemoteFileOutboundGateway.get()` uses `Session.list()` for the provided remote file name. The `SmbSession` does not support listing for a single file. * Add logic into `SmbSession.list()` similar to `SftpSession.list()` to list a single remote file on the provided path **Auto-cherry-pick to `6.3.x` & `6.2.x`**
Spring integration version used: 6.2.1 (also tested on 6.2.5)
When configuring a SMB outbound gateway through XML configuration with a 'get' command, and point the 'expression' field to the name of the file I with to retrieve, I receive an IOException:
[path] is not a directory. Cannot list resources
Upon some further investigation, it appears that AbstractRemoteFileOutboundGateway#get, that is invoked for get commands will execute a list action against the (Smb)Session. The list action is supposed to return a single file. If so, it is copied to the local directory, otherwise an error is thrown. In contrast with the SftpSession#list, the SmbSession#list will always throw an example if a list is attempted on a non-directory SMB file.
It seems that the SmbSession should also have logic in place that will list the directory instead, and filter files based on the path provided, just like the SftpSession has? When using SFTP instead of SMB, a similar setup as presented below works.
To Reproduce
Configure a SMB share that hosts a simple 'smbtest.txt' file in the 'test' folder.
Run the XML below (with the proper directory) and see that.
Expected behavior
The file is created in the auto-created 'tmp' local directory.
The text was updated successfully, but these errors were encountered: