Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 398685 - default file client createFolder() result often has wrong
Name value
--Signed-off-by: Elijah El-Haddad <elijahe@ca.ibm.com>
  • Loading branch information
elijahe committed Jan 22, 2014
1 parent dad7608 commit 0c7c5af
Showing 1 changed file with 12 additions and 3 deletions.
Expand Up @@ -41,9 +41,18 @@ public void addAtributesFor(HttpServletRequest request, URI resource, JSONObject
try {
URI base = new URI(resource.getScheme(), resource.getUserInfo(), resource.getHost(), resource.getPort(), request.getServletPath() + "/", null, null);
IPath basePath = new Path(base.getPath());
IPath resourcePath = new Path(resource.getPath());
if (resourcePath.hasTrailingSeparator() && !representation.getBoolean(ProtocolConstants.KEY_DIRECTORY)) {
resourcePath = resourcePath.append(representation.getString(ProtocolConstants.KEY_NAME));
IPath resourcePath = null;
try {
String locationString = representation.getString(ProtocolConstants.KEY_LOCATION);
URI location = new URI(locationString);
resourcePath = new Path(location.getPath());
} catch (JSONException je) {
// no String value found for ProtocolConstants.KEY_LOCATION,
// use resource path instead
resourcePath = new Path(resource.getPath());
if (resourcePath.hasTrailingSeparator() && !representation.getBoolean(ProtocolConstants.KEY_DIRECTORY)) {
resourcePath = resourcePath.append(representation.getString(ProtocolConstants.KEY_NAME));
}
}
IPath path = resourcePath.makeRelativeTo(basePath);
//nothing to do if request is not a folder or file
Expand Down

0 comments on commit 0c7c5af

Please sign in to comment.