mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user