mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
59029: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 58994: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1) 58832: Merged DEV to V4.1-BUG-FIX (4.1.8) 57649: MNT-9900 : Alfresco Explorer is using URL Encoding when downloading a file Changed the encoding/decoding behavior for filenames in different browsers. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62073 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -388,8 +388,21 @@ public abstract class BaseDownloadContentServlet extends BaseServlet
|
||||
// this is better than the default response of the browser trying to display the contents
|
||||
|
||||
// IE requires that "Content-Disposition" header in case of "attachment" type should include
|
||||
// "filename" part. Should be harmless in other browsers.
|
||||
res.setHeader(HEADER_CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(filename)+ "\"");
|
||||
// "filename" part. See MNT-9900
|
||||
String userAgent = req.getHeader(HEADER_USER_AGENT);
|
||||
if (userAgent != null && userAgent.toLowerCase().contains("msie"))
|
||||
{
|
||||
res.setHeader(HEADER_CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(filename) + "\"");
|
||||
}
|
||||
else if (userAgent != null && (userAgent.toLowerCase().contains("firefox") || userAgent.toLowerCase().contains("safari")))
|
||||
{
|
||||
res.setHeader(HEADER_CONTENT_DISPOSITION, "attachment; filename=\"" + URLDecoder.decode(filename) + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
res.setHeader(HEADER_CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user