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

Spring Integration Smb upload fails to create missing remote directory when running on Windows #9453

Closed
pfosser opened this issue Sep 12, 2024 · 1 comment · Fixed by #9454

Comments

@pfosser
Copy link
Contributor

pfosser commented Sep 12, 2024

Hi, the method linked above checks the remote path (which is a smb path) for FILE_SEPARATOR which is initialized as

private static final String FILE_SEPARATOR = FileSystems.getDefault().getSeparator();

Clearly on Windows that is "\" which is never found in a smb path. So the need to create possibly missing remote dirs is never detected.

@artembilan
Copy link
Member

Yeah...
I don't see a reason in that FILE_SEPARATOR constant at all.
We really deal with remote SMB paths over there, so, the separator is supposed to be that simple /.

Feel free to contribute the fix: https://github.com/spring-projects/spring-integration/blob/main/CONTRIBUTING.adoc!

@artembilan artembilan added this to the 6.4.0-M3 milestone Sep 12, 2024
pfosser added a commit to pfosser/spring-integration that referenced this issue Sep 12, 2024
Fixes: spring-projects#9453
Issue link: spring-projects#9453

On a smb file upload, to detect the need for new remote directories,
the remote path was checked for the local filesystem path separator.
On Windows that is \\ which is never found in a smb path, so the
necessary remote path was not created and the operation failed.

Use the correct separator which was already available as a
constant.
pfosser added a commit to pfosser/spring-integration that referenced this issue Sep 12, 2024
Fixes: spring-projects#9453
Issue link: spring-projects#9453

On a smb file upload, to detect the need for new remote directories,
the remote path was checked for the local filesystem path separator.
On Windows that is \\ which is never found in a smb path, so the
necessary remote path was not created and the operation failed.

Use the correct separator which was already available as a
constant.
pfosser added a commit to pfosser/spring-integration that referenced this issue Sep 13, 2024
Fixes: spring-projects#9453
Issue link: spring-projects#9453

On a smb file upload, to detect the need for new remote directories,
the remote path was checked for the local filesystem path separator.
On Windows that is \\ which is never found in a smb path, so the
necessary remote path was not created and the operation failed.

Use the correct separator which was already available as a
constant.
spring-builds pushed a commit that referenced this issue Sep 13, 2024
Fixes: #9453
Issue link: #9453

On a smb file upload, to detect the need for new remote directories,
the remote path was checked for the local filesystem path separator.
On Windows that is \\ which is never found in a smb path, so the
necessary remote path was not created and the operation failed.

Use the correct separator which was already available as a constant.

(cherry picked from commit 4cccee7)
spring-builds pushed a commit that referenced this issue Sep 13, 2024
Fixes: #9453
Issue link: #9453

On a smb file upload, to detect the need for new remote directories,
the remote path was checked for the local filesystem path separator.
On Windows that is \\ which is never found in a smb path, so the
necessary remote path was not created and the operation failed.

Use the correct separator which was already available as a constant.

(cherry picked from commit 4cccee7)
artembilan added a commit that referenced this issue Sep 17, 2024
Related to: #9453

The `SmbSession` does not rely on a system file separator anymore
and just use regular Unix `/` separator all the time.
Therefore, `TestUtils.applySystemFileSeparator()` is wrong from test perspective on Windows

**Auto-cherry-pick to `6.3.x` & `6.2.x`**
spring-builds pushed a commit that referenced this issue Sep 17, 2024
Related to: #9453

The `SmbSession` does not rely on a system file separator anymore
and just use regular Unix `/` separator all the time.
Therefore, `TestUtils.applySystemFileSeparator()` is wrong from test perspective on Windows

(cherry picked from commit 64b49d1)
spring-builds pushed a commit that referenced this issue Sep 17, 2024
Related to: #9453

The `SmbSession` does not rely on a system file separator anymore
and just use regular Unix `/` separator all the time.
Therefore, `TestUtils.applySystemFileSeparator()` is wrong from test perspective on Windows

(cherry picked from commit 64b49d1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants