mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
124423 aleahu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) 124409 cturlica: MNT-15715: CLONE - The file extension of any unknown mimetype is lost during download and replaced by .bin. - Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4) 122029 amukha: MNT-14412: The file extension of any unknown mimetype is lost during download and replaced by .bin. - Now the mimetype guessing is not done for IE if the mimetype is binary (possibly unknown for Alfresco) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@124450 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2016 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -26,6 +26,7 @@ import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -158,7 +159,11 @@ public class ContentGet extends StreamContent implements ServletContextAware
|
||||
if (userAgent.contains("msie") || userAgent.contains(" trident/"))
|
||||
{
|
||||
String mimeType = contentService.getReader(nodeRef, propertyQName).getMimetype();
|
||||
if (!mimetypeService.getMimetypes(FilenameUtils.getExtension(name)).contains(mimeType))
|
||||
// If we have an unknown mime type (usually marked as binary)
|
||||
// it is better to stay with the file extension we currently have
|
||||
// see MNT-14412
|
||||
if (!mimeType.toLowerCase().equals(MimetypeMap.MIMETYPE_BINARY)
|
||||
&& !mimetypeService.getMimetypes(FilenameUtils.getExtension(name)).contains(mimeType))
|
||||
{
|
||||
name = FilenameUtils.removeExtension(name) + FilenameUtils.EXTENSION_SEPARATOR_STR + mimetypeService.getExtension(mimeType);
|
||||
}
|
||||
|
Reference in New Issue
Block a user