Skip to content
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 inbound channel adapter behavior changed with 6.2.6 #9268

Closed
smitsjelle opened this issue Jun 24, 2024 · 0 comments
Closed

SMB inbound channel adapter behavior changed with 6.2.6 #9268

smitsjelle opened this issue Jun 24, 2024 · 0 comments

Comments

@smitsjelle
Copy link

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>
@smitsjelle smitsjelle added status: waiting-for-triage The issue need to be evaluated and its future decided type: bug labels Jun 24, 2024
@smitsjelle smitsjelle changed the title SMB inbound channel adapter behavoir changed with 6.2.6 SMB inbound channel adapter behavior changed with 6.2.6 Jun 24, 2024
@artembilan artembilan added this to the 6.4.0-M1 milestone Jun 24, 2024
@artembilan artembilan added in: smb (EOL) for: backport-to-6.2.x for: backport-to-6.3.x and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels Jun 24, 2024
spring-builds pushed a commit that referenced this issue Jun 24, 2024
Fixes: #9268

The new `SmbSession.list()` behavior prevents to pull files from sub-folders in inbound channel adapter

* Fix `SmbSession.list()` similar way to `SftpSession`: if `remoteFile.isFile()` then remove it as is.
Otherwise, perform `smbDir.listFiles()` on that sub-dir
* Modify `SmbTests.testSmbInboundFlow()` to poll files from the `smbSource/subSmbSource/`

(cherry picked from commit f2399a4)
spring-builds pushed a commit that referenced this issue Jun 24, 2024
Fixes: #9268

The new `SmbSession.list()` behavior prevents to pull files from sub-folders in inbound channel adapter

* Fix `SmbSession.list()` similar way to `SftpSession`: if `remoteFile.isFile()` then remove it as is.
Otherwise, perform `smbDir.listFiles()` on that sub-dir
* Modify `SmbTests.testSmbInboundFlow()` to poll files from the `smbSource/subSmbSource/`

(cherry picked from commit f2399a4)
EddieChoCho pushed a commit to EddieChoCho/spring-integration that referenced this issue Jun 26, 2024
Fixes: spring-projects#9268

The new `SmbSession.list()` behavior prevents to pull files from sub-folders in inbound channel adapter

* Fix `SmbSession.list()` similar way to `SftpSession`: if `remoteFile.isFile()` then remove it as is.
Otherwise, perform `smbDir.listFiles()` on that sub-dir
* Modify `SmbTests.testSmbInboundFlow()` to poll files from the `smbSource/subSmbSource/`

**Auto-cherry-pick to `6.3.x` & `6.2.x`**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants