Skip to content

Commit 0aad93a

Browse files
committed
GH-9453: Correct separator when checking smb path
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.
1 parent 775bfd6 commit 0aad93a

File tree

1 file changed

+1
-3
lines changed
  • spring-integration-smb/src/main/java/org/springframework/integration/smb/session

1 file changed

+1
-3
lines changed

spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbSession.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ public class SmbSession implements Session<SmbFile> {
6161

6262
private static final LogAccessor logger = new LogAccessor(SmbSession.class);
6363

64-
private static final String FILE_SEPARATOR = FileSystems.getDefault().getSeparator();
65-
6664
private static final String SMB_FILE_SEPARATOR = "/";
6765

6866
private final SmbShare smbShare;
@@ -338,7 +336,7 @@ public boolean isDirectory(String _path) throws IOException {
338336
* @throws IOException on error conditions returned by a CIFS server
339337
*/
340338
String mkdirs(String _path) throws IOException {
341-
int idxPath = _path.lastIndexOf(FILE_SEPARATOR);
339+
int idxPath = _path.lastIndexOf(SMB_FILE_SEPARATOR);
342340
if (idxPath > -1) {
343341
String path = _path.substring(0, idxPath + 1);
344342
mkdir(path);

0 commit comments

Comments
 (0)