mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +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:
@@ -37,11 +37,11 @@ import org.alfresco.service.cmr.repository.ContentIOException;
|
|||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
import org.springframework.extensions.webscripts.WebScriptException;
|
import org.springframework.extensions.webscripts.WebScriptException;
|
||||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AVM Remote Store service.
|
* AVM Remote Store service.
|
||||||
@@ -151,11 +151,7 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
if (extIndex != -1)
|
if (extIndex != -1)
|
||||||
{
|
{
|
||||||
String ext = path.substring(extIndex + 1);
|
String ext = path.substring(extIndex + 1);
|
||||||
String mt = mimetypeService.getMimetypesByExtension().get(ext);
|
mimetype = mimetypeService.getMimetype(ext);
|
||||||
if (mt != null)
|
|
||||||
{
|
|
||||||
mimetype = mt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -460,11 +460,7 @@ public class StreamContent extends AbstractWebScript
|
|||||||
int extIndex = filePath.lastIndexOf('.');
|
int extIndex = filePath.lastIndexOf('.');
|
||||||
if (extIndex != -1)
|
if (extIndex != -1)
|
||||||
{
|
{
|
||||||
String mt = mimetypeService.getMimetypesByExtension().get(filePath.substring(extIndex + 1));
|
mimetype = mimetypeService.getMimetype(filePath.substring(extIndex + 1));
|
||||||
if (mt != null)
|
|
||||||
{
|
|
||||||
mimetype = mt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup file reader and stream
|
// setup file reader and stream
|
||||||
@@ -520,11 +516,7 @@ public class StreamContent extends AbstractWebScript
|
|||||||
if (extIndex != -1)
|
if (extIndex != -1)
|
||||||
{
|
{
|
||||||
String ext = extensionPath.substring(extIndex + 1);
|
String ext = extensionPath.substring(extIndex + 1);
|
||||||
String mt = mimetypeService.getMimetypesByExtension().get(ext);
|
mimetype = mimetypeService.getMimetype(ext);
|
||||||
if (mt != null)
|
|
||||||
{
|
|
||||||
mimetype = mt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user