Fix to URLEncoder issues with UTF-8 characters for download content links and WebDav generated links

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2019 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2005-12-09 14:18:37 +00:00
parent d63e6da00a
commit 7bb53f0620
2 changed files with 5 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.LoginBean; import org.alfresco.web.bean.LoginBean;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
@@ -255,7 +256,7 @@ public class DownloadContentServlet extends HttpServlet
ref.getStoreRef().getProtocol(), ref.getStoreRef().getProtocol(),
ref.getStoreRef().getIdentifier(), ref.getStoreRef().getIdentifier(),
ref.getId(), ref.getId(),
URLEncoder.encode(name, "US-ASCII") } ); Utils.replace(URLEncoder.encode(name, "UTF-8"), "+", "%20") } );
} }
catch (UnsupportedEncodingException uee) catch (UnsupportedEncodingException uee)
{ {
@@ -285,7 +286,7 @@ public class DownloadContentServlet extends HttpServlet
ref.getStoreRef().getProtocol(), ref.getStoreRef().getProtocol(),
ref.getStoreRef().getIdentifier(), ref.getStoreRef().getIdentifier(),
ref.getId(), ref.getId(),
URLEncoder.encode(name, "US-ASCII") } ); Utils.replace(URLEncoder.encode(name, "UTF-8"), "+", "%20") } );
} }
catch (UnsupportedEncodingException uee) catch (UnsupportedEncodingException uee)
{ {

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.ui.common; package org.alfresco.web.ui.common;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@@ -511,7 +512,7 @@ public final class Utils
path.append("/").append(paths.get(x).getName()); path.append("/").append(paths.get(x).getName());
} }
url = path.toString(); url = Utils.replace(URLEncoder.encode(path.toString(), "UTF-8"), "+", "%20");
} }
catch (Exception e) catch (Exception e)
{ {