mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed problem with URL decoding when Unicode characters are present in URL.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2061 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,7 +17,9 @@
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -43,7 +45,7 @@ public class WebDAV
|
||||
{
|
||||
// Logging
|
||||
|
||||
private static Log logger = LogFactory.getLog("org.alfresco.protocol.webdav");
|
||||
private static Log logger = LogFactory.getLog("org.alfresco.webdav.protocol");
|
||||
|
||||
// WebDAV XML namespace
|
||||
|
||||
@@ -335,8 +337,22 @@ public class WebDAV
|
||||
{
|
||||
// Try and get the path
|
||||
|
||||
String strPath = request.getPathInfo();
|
||||
String strPath = null;
|
||||
|
||||
try {
|
||||
strPath = URLDecoder.decode( request.getRequestURI(), "UTF-8");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
|
||||
// Find the servlet path and trim from the request path
|
||||
|
||||
String servletPath = request.getServletPath();
|
||||
|
||||
int rootPos = strPath.indexOf(servletPath);
|
||||
if ( rootPos != -1)
|
||||
strPath = strPath.substring( rootPos);
|
||||
|
||||
// If we failed to get the path from the request try and get the path from the servlet path
|
||||
|
||||
if (strPath == null)
|
||||
@@ -372,7 +388,7 @@ public class WebDAV
|
||||
|
||||
// Return the path
|
||||
|
||||
return decodeURL(strPath);
|
||||
return strPath;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -403,7 +419,27 @@ public class WebDAV
|
||||
urlStr.append(path);
|
||||
}
|
||||
|
||||
return urlStr.toString();
|
||||
// If the URL is to a collection add a trailing slash
|
||||
|
||||
if ( isCollection && urlStr.charAt( urlStr.length() - 1) != PathSeperatorChar)
|
||||
urlStr.append( PathSeperator);
|
||||
|
||||
// Encode the URL
|
||||
|
||||
String encUrlStr = null;
|
||||
|
||||
try
|
||||
{
|
||||
encUrlStr = URLEncoder.encode( urlStr.toString(), "UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException ex)
|
||||
{
|
||||
logger.error(ex);
|
||||
}
|
||||
|
||||
// Return the encoded URL string
|
||||
|
||||
return encUrlStr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user