mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALF-2118:
- Added new method to MimetypeService to retrieve a valid mimetype given any extension, handling case and missing values - Updated JUnit tests for MimetypeService methods - Fixed callers of MimetypeService to use new method to protect against varying case of file extensions (ALF-2118 root cause) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19400 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -48,11 +48,11 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
|||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.springframework.extensions.surf.util.URLDecoder;
|
|
||||||
import org.springframework.extensions.surf.util.URLEncoder;
|
|
||||||
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.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.springframework.extensions.surf.util.URLDecoder;
|
||||||
|
import org.springframework.extensions.surf.util.URLEncoder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for the download content servlets. Provides common
|
* Base class for the download content servlets. Provides common
|
||||||
@@ -289,11 +289,7 @@ public abstract class BaseDownloadContentServlet extends BaseServlet
|
|||||||
if (extIndex != -1)
|
if (extIndex != -1)
|
||||||
{
|
{
|
||||||
String ext = filename.substring(extIndex + 1);
|
String ext = filename.substring(extIndex + 1);
|
||||||
String mt = mimetypeMap.getMimetypesByExtension().get(ext);
|
mimetype = mimetypeMap.getMimetype(ext);
|
||||||
if (mt != null)
|
|
||||||
{
|
|
||||||
mimetype = mt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -174,11 +174,7 @@ public class UploadContentServlet extends BaseServlet
|
|||||||
if (extIndex != -1)
|
if (extIndex != -1)
|
||||||
{
|
{
|
||||||
String ext = filename.substring(extIndex + 1);
|
String ext = filename.substring(extIndex + 1);
|
||||||
String mt = mimetypeMap.getMimetypesByExtension().get(ext);
|
mimetype = mimetypeService.getMimetype(ext);
|
||||||
if (mt != null)
|
|
||||||
{
|
|
||||||
mimetype = mt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -522,12 +522,8 @@ public final class Repository
|
|||||||
int extIndex = filename.lastIndexOf('.');
|
int extIndex = filename.lastIndexOf('.');
|
||||||
if (extIndex != -1)
|
if (extIndex != -1)
|
||||||
{
|
{
|
||||||
String ext = filename.substring(extIndex + 1).toLowerCase();
|
String ext = filename.substring(extIndex + 1);
|
||||||
String mt = mimetypeService.getMimetypesByExtension().get(ext);
|
mimetype = mimetypeService.getMimetype(ext);
|
||||||
if (mt != null)
|
|
||||||
{
|
|
||||||
mimetype = mt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mimetype;
|
return mimetype;
|
||||||
|
Reference in New Issue
Block a user