From c80d13c92f32654011431d53cc0e6f48339102ad Mon Sep 17 00:00:00 2001 From: Mark Rogers Date: Wed, 19 Oct 2011 16:24:54 +0000 Subject: [PATCH] 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 --- .../org/alfresco/web/ui/common/Utils.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/source/java/org/alfresco/web/ui/common/Utils.java b/source/java/org/alfresco/web/ui/common/Utils.java index ba8aeb0b75..687f9538e1 100644 --- a/source/java/org/alfresco/web/ui/common/Utils.java +++ b/source/java/org/alfresco/web/ui/common/Utils.java @@ -363,17 +363,25 @@ public final class Utils extends StringUtils context).getFileFolderService(); try { - List paths = fileFolderService.getNamePath(null, node.getNodeRef()); - - // build up the webdav url - StringBuilder path = new StringBuilder("/").append(WebDAVServlet.WEBDAV_PREFIX); - - // build up the path skipping the first path as it is the root folder - for (int x = 1; x < paths.size(); x++) + NodeRef rootNode = WebDAVServlet.getWebdavRootNode(); + if (rootNode != null) { - path.append("/").append(WebDAVHelper.encodeURL(paths.get(x).getName(), getUserAgent(context))); + // build up the webdav url + StringBuilder path = new StringBuilder("/").append(WebDAVServlet.WEBDAV_PREFIX); + + if (!rootNode.equals(node.getNodeRef())) + { + + List paths = fileFolderService.getNamePath(rootNode, node.getNodeRef()); + + // build up the path skipping the first path as it is the root folder + for (int x = 0; x < paths.size(); x++) + { + path.append("/").append(WebDAVHelper.encodeURL(paths.get(x).getName(), getUserAgent(context))); + } + } + url = path.toString(); } - url = path.toString(); } catch (AccessDeniedException e) {