diff --git a/source/java/org/alfresco/repo/webdav/GetMethod.java b/source/java/org/alfresco/repo/webdav/GetMethod.java index b00572cdcc..c756cdcb9b 100644 --- a/source/java/org/alfresco/repo/webdav/GetMethod.java +++ b/source/java/org/alfresco/repo/webdav/GetMethod.java @@ -430,8 +430,8 @@ public class GetMethod extends WebDAVMethod writer.write(""); writer.write("["); @@ -553,6 +553,29 @@ public class GetMethod extends WebDAVMethod } } + /** + * Given a path, will return the parent path. For example: /a/b/c + * will return /a/b and /a/b will return /a. + * + * @param path The path to return the parent of - must be non-null. + * @return String - parent path. + */ + private String parentFolder(String path) + { + if (path.endsWith(WebDAVHelper.PathSeperator)) + { + // Strip trailing slash. + path = path.substring(0, path.length() - 1); + } + String[] paths = getDAVHelper().splitPath(path); + String parent = paths[0]; + if (parent.equals("")) + { + parent = WebDAVHelper.PathSeperator; + } + return parent; + } + /** * Formats the given size for display in a directory listing *