Description
Spring integration version used: 6.2.6
As discussed in GH-9211, creating a new issue for this item:
I have applied the fix introduced in 6.2.6 from the issue above 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 somedir/anotherdir directory. With the applied changes this 'list' operation is considered to be a get single file operation, and will fail with IOException: [somedir/anotherdir] is not a file
. As a workaround, it seems that it is possible to provide 'remote-directory' as somedir\anotherdir
, as that bypasses line 137 that checks for the occurence of the /
, and the SMB calls seem to become normalized (as I am now effectively calling the path (...)/test/somedir\anotherdir/
).
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:
<smb:inbound-channel-adapter
session-factory="smbSessionFactory"
local-directory="/tmp/smb"
auto-create-local-directory="true"
channel="smbInbound"
remote-directory="somedir/anotherdir"> <!-- Used to work pre-6.2.6, now needs to be 'somedir\anotherdir' to achieve the same -->
<si:poller fixed-rate="10" time-unit="SECONDS"/>
</smb:inbound-channel-adapter>
<si:channel id="smbInbound"/>
(...)
<bean id="smbSessionFactory" class="org.springframework.integration.smb.session.SmbSessionFactory">
<property name="host" value="localhost"/>
<property name="domain" value=""/>
<property name="username" value="username"/>
<property name="password" value="password"/>
<property name="shareAndDir" value="test"/>
</bean>