Ensure proper file extension for image files
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@116 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
81d548ec11
commit
c2ce12b09e
2 changed files with 12 additions and 2 deletions
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2011-02-19)
|
||||
* Version 1.2 (2011-07-22)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -132,7 +132,15 @@ public final class ImageLoader {
|
|||
EmbeddedBinaryObject object = (EmbeddedBinaryObject) obj;
|
||||
blob = object.getBinaryData();
|
||||
sMIME = object.getType();
|
||||
sExt = MIMETypes.getFileExtension(sMIME);
|
||||
if (sMIME.length()>0) {
|
||||
// If the manifest provides a media type, trust that
|
||||
sExt = MIMETypes.getFileExtension(sMIME);
|
||||
}
|
||||
else {
|
||||
// Otherwise determine it by byte inspection
|
||||
sMIME = MIMETypes.getMagicMIMEType(blob);
|
||||
sExt = MIMETypes.getFileExtension(sMIME);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// This is a linked image
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue