MERGED DEV TO HEAD

ALF-10821 : WebDAV malformed URL

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31364 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2011-10-19 16:24:54 +00:00
parent 28b2d08ab2
commit c80d13c92f

View File

@@ -363,18 +363,26 @@ public final class Utils extends StringUtils
context).getFileFolderService(); context).getFileFolderService();
try try
{ {
List<FileInfo> paths = fileFolderService.getNamePath(null, node.getNodeRef()); NodeRef rootNode = WebDAVServlet.getWebdavRootNode();
if (rootNode != null)
{
// build up the webdav url // build up the webdav url
StringBuilder path = new StringBuilder("/").append(WebDAVServlet.WEBDAV_PREFIX); StringBuilder path = new StringBuilder("/").append(WebDAVServlet.WEBDAV_PREFIX);
if (!rootNode.equals(node.getNodeRef()))
{
List<FileInfo> paths = fileFolderService.getNamePath(rootNode, node.getNodeRef());
// build up the path skipping the first path as it is the root folder // build up the path skipping the first path as it is the root folder
for (int x = 1; x < paths.size(); x++) for (int x = 0; x < paths.size(); x++)
{ {
path.append("/").append(WebDAVHelper.encodeURL(paths.get(x).getName(), getUserAgent(context))); path.append("/").append(WebDAVHelper.encodeURL(paths.get(x).getName(), getUserAgent(context)));
} }
}
url = path.toString(); url = path.toString();
} }
}
catch (AccessDeniedException e) catch (AccessDeniedException e)
{ {
// cannot build path if user don't have access all the way up // cannot build path if user don't have access all the way up