mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)
71607: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 70363: Merged DEV to V4.2-BUG-FIX (4.2.3) 69771: MNT-11246: Inconsistent file handling when opening a document from history view in IE 10 compared to Firefox - Change document extension in case when user agent is "IE" and it's current extension doesn't correspond it's mimetype. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74697 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -358,6 +358,7 @@
|
||||
<property name="mimetypeService" ref="MimetypeService" />
|
||||
<property name="CMISRenditionService" ref="CMISRenditionService" />
|
||||
<property name="delegate" ref="webscript.content.streamer" />
|
||||
<property name="contentService" ref="contentService" />
|
||||
</bean>
|
||||
|
||||
<!-- Content Info -->
|
||||
|
@@ -36,10 +36,12 @@ import org.alfresco.repo.cmis.reference.ReferenceFactory;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.web.scripts.FileTypeImageUtils;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.FileTypeImageSize;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
@@ -69,6 +71,7 @@ public class ContentGet extends StreamContent implements ServletContextAware
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespaceService namespaceService;
|
||||
private CMISRenditionService renditionService;
|
||||
private ContentService contentService;
|
||||
|
||||
/**
|
||||
* @param
|
||||
@@ -110,6 +113,14 @@ public class ContentGet extends StreamContent implements ServletContextAware
|
||||
this.renditionService = renditionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param contentService
|
||||
*/
|
||||
public void setContentService(ContentService contentService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
||||
*/
|
||||
@@ -177,6 +188,18 @@ public class ContentGet extends StreamContent implements ServletContextAware
|
||||
if (attach && rfc5987Supported)
|
||||
{
|
||||
String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
|
||||
//IE use file extension to get mimetype
|
||||
//So we set correct extension. see MNT-11246
|
||||
if(userAgent.contains("MSIE"))
|
||||
{
|
||||
String mimeType = contentService.getReader(nodeRef, propertyQName).getMimetype();
|
||||
if (!mimetypeService.getMimetypes(FilenameUtils.getExtension(name)).contains(mimeType))
|
||||
{
|
||||
name = FilenameUtils.removeExtension(name) + FilenameUtils.EXTENSION_SEPARATOR_STR + mimetypeService.getExtension(mimeType);
|
||||
}
|
||||
}
|
||||
|
||||
streamContent(req, res, nodeRef, propertyQName, attach, name, null);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user