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

GH-9453: Correct separator when checking smb path #9454

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.nio.file.FileSystems;
import java.util.Arrays;

import jcifs.smb.SmbException;
Expand Down Expand Up @@ -54,15 +53,14 @@
* @author Prafull Kumar Soni
* @author Gregory Bragg
* @author Adam Jones
* @author Paolo Fosser
*
* @since 6.0
*/
public class SmbSession implements Session<SmbFile> {

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

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

private static final String SMB_FILE_SEPARATOR = "/";

private final SmbShare smbShare;
Expand Down Expand Up @@ -338,7 +336,7 @@ public boolean isDirectory(String _path) throws IOException {
* @throws IOException on error conditions returned by a CIFS server
*/
String mkdirs(String _path) throws IOException {
int idxPath = _path.lastIndexOf(FILE_SEPARATOR);
int idxPath = _path.lastIndexOf(SMB_FILE_SEPARATOR);
if (idxPath > -1) {
String path = _path.substring(0, idxPath + 1);
mkdir(path);
Expand Down