mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
57029: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 56496: Merged HEAD-BUG-FIX to V4.2-BUG-FIX (4.2.1) 55754: Merged V4.1-BUG-FIX (4.1.7) to HEAD-BUG-FIX 54754: Merged V4.1.6 (4.1.6) to V4.1-BUG-FIX (4.1.7) 54570: MNT-2258: IE's File Download box does not show a filename correctly when that have non-ASCII characters in the filename For file download in IE8 use legacy filename token with encoded value in "Content-Disposition" header git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61662 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -46,7 +46,7 @@ public class ContentInfo extends StreamContent
|
||||
{
|
||||
|
||||
private ReferenceFactory referenceFactory;
|
||||
|
||||
|
||||
public void setReferenceFactory(ReferenceFactory referenceFactory)
|
||||
{
|
||||
this.referenceFactory = referenceFactory;
|
||||
@@ -79,7 +79,7 @@ public class ContentInfo extends StreamContent
|
||||
boolean attach, Date modified, String eTag, String attachFileName)
|
||||
throws IOException
|
||||
{
|
||||
setAttachment(res, attach, attachFileName);
|
||||
delegate.setAttachment(req, res, attach, attachFileName);
|
||||
|
||||
// establish mimetype
|
||||
String mimetype = reader.getMimetype();
|
||||
|
@@ -526,7 +526,7 @@ public class ContentStreamer implements ResourceLoaderAware
|
||||
String attachFileName,
|
||||
Map<String, Object> model) throws IOException
|
||||
{
|
||||
setAttachment(res, attach, attachFileName);
|
||||
setAttachment(null, res, attach, attachFileName);
|
||||
|
||||
// establish mimetype
|
||||
String mimetype = reader.getMimetype();
|
||||
@@ -611,11 +611,12 @@ public class ContentStreamer implements ResourceLoaderAware
|
||||
/**
|
||||
* Set attachment header
|
||||
*
|
||||
* @param req
|
||||
* @param res
|
||||
* @param attach
|
||||
* @param attachFileName
|
||||
*/
|
||||
public void setAttachment(WebScriptResponse res, boolean attach, String attachFileName)
|
||||
public void setAttachment(WebScriptRequest req, WebScriptResponse res, boolean attach, String attachFileName)
|
||||
{
|
||||
if (attach == true)
|
||||
{
|
||||
@@ -624,8 +625,26 @@ public class ContentStreamer implements ResourceLoaderAware
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Attaching content using filename: " + attachFileName);
|
||||
|
||||
headerValue += "; filename*=UTF-8''" + WebDAVHelper.encodeURL(attachFileName) + "; filename=\"" + attachFileName + "\"";
|
||||
|
||||
if (req == null)
|
||||
{
|
||||
headerValue += "; filename*=UTF-8''" + WebDAVHelper.encodeURL(attachFileName)
|
||||
+ "; filename=\"" + attachFileName + "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
String userAgent = req.getHeader(HEADER_USER_AGENT);
|
||||
boolean isMSIE8 = (null != userAgent) && userAgent.contains("MSIE 8");
|
||||
if (isMSIE8)
|
||||
{
|
||||
headerValue += "; filename=\"" + WebDAVHelper.encodeURL(attachFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
headerValue += "; filename=\"" + attachFileName + "\"; filename*=UTF-8''"
|
||||
+ WebDAVHelper.encodeURL(attachFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set header based on filename - will force a Save As from the browse if it doesn't recognize it
|
||||
|
@@ -60,7 +60,7 @@ public class StreamContent extends AbstractWebScript
|
||||
protected PermissionService permissionService;
|
||||
protected NodeService nodeService;
|
||||
protected MimetypeService mimetypeService;
|
||||
private ContentStreamer delegate;
|
||||
protected ContentStreamer delegate;
|
||||
|
||||
/**
|
||||
* @param mimetypeService
|
||||
@@ -194,7 +194,7 @@ public class StreamContent extends AbstractWebScript
|
||||
*/
|
||||
protected void setAttachment(WebScriptResponse res, boolean attach, String attachFileName)
|
||||
{
|
||||
delegate.setAttachment(res, attach, attachFileName);
|
||||
delegate.setAttachment(null, res, attach, attachFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user