THOR-1459: WebDAV: site names cannot start with 'webdav'

Core changes to ensure that path extraction is performed correctly.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37157 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-05-29 16:10:11 +00:00
parent eb0004fce5
commit 55019252ca
4 changed files with 119 additions and 6 deletions

View File

@@ -691,7 +691,7 @@ public class WebDAVHelper
* @param destURL The Destination header.
* @return The path to move/copy the file to.
*/
public String getDestinationPath(String servletPath, String destURL)
public String getDestinationPath(String contextPath, String servletPath, String destURL)
{
if (destURL != null && destURL.length() > 0)
{
@@ -715,10 +715,16 @@ public class WebDAVHelper
offset = destURL.indexOf(WebDAV.PathSeperator, offset);
if (offset != -1)
{
// Strip the host from the beginning
String strPath = destURL.substring(offset);
offset = strPath.indexOf(servletPath);
if (offset != -1)
strPath = strPath.substring(offset + servletPath.length());
// If it starts with /contextPath/servletPath/ (e.g. /alfresco/webdav/path/to/file) - then
// strip the servlet path from the start of the path.
String pathPrefix = contextPath + servletPath + WebDAV.PathSeperator;
if (strPath.startsWith(pathPrefix))
{
strPath = strPath.substring(pathPrefix.length());
}
return WebDAV.decodeURL(strPath);
}