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

Bug Fixes #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions src/main/java/jcifs/smb/Handler.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ protected void parseURL ( URL u, String spec, int start, int limit ) {
else if ( spec.startsWith("smb://") == false && host != null && host.length() == 0 ) {
spec = "//" + spec;
limit += 2;
} else {
// TODO: verify that this is a valid rule!
// Change made to fix problems when deleting directory children recursively
if (u.getPath() != null) {
String separator = u.getPath().endsWith("/") || spec.startsWith("/") ? "" : "/";
spec = u.getPath() + separator + spec;
limit = spec.length();
}
}
super.parseURL(u, spec, start, limit);
path = u.getPath();
Expand All @@ -109,4 +117,5 @@ else if ( spec.startsWith("smb://") == false && host != null && host.length() ==
}
setURL(u, "smb", u.getHost(), port, u.getAuthority(), u.getUserInfo(), path, u.getQuery(), null);
}

}
8 changes: 6 additions & 2 deletions src/main/java/jcifs/smb/SmbResourceLocatorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,12 @@ void resolveInContext ( SmbResourceLocator context, String name ) {
this.share = shr;
}
else {
this.unc = uncPath + name.replace('/', '\\') + ( trailingSlash ? "\\" : "" );
this.canon = context.getURLPath() + name + ( trailingSlash ? "/" : "" );
// Make sure there's a file separator between uncPath and name.
String separator = (uncPath.endsWith("\\") || name.startsWith("/")) ? "" : "\\";
this.unc = uncPath + separator + name.replace('/', '\\') + ( trailingSlash ? "\\" : "" );
// Make sure there's a file separator between context's url path and name
separator = (context.getURLPath().endsWith("/") || name.startsWith("/")) ? "" : "/";
this.canon = context.getURLPath() + separator + name + ( trailingSlash ? "/" : "" );
this.share = shr;
}
}
Expand Down