mirror of
https://github.com/zotero/zotero.git
synced 2026-10-08 03:08:19 +00:00
More snapshot-related tweaks:
- Only use saveDocument() for text/html snapshots - Add 'application/xhtml+xml' and 'application/xml' as native MIME types - When loading attachment, check recorded MIME type first before detecting
This commit is contained in:
parent
0d145cd47b
commit
b383fb6aa7
3 changed files with 10 additions and 16 deletions
|
|
@ -1069,7 +1069,13 @@ var ZoteroPane = new function()
|
|||
{
|
||||
var file = attachment.getFile();
|
||||
if (file){
|
||||
if (Zotero.MIME.fileHasInternalHandler(file))
|
||||
var mimeType = attachment.getAttachmentMimeType();
|
||||
if (mimeType) {
|
||||
var ext = Zotero.File.getExtension(file);
|
||||
var internal = Zotero.MIME.hasInternalHandler(mimeType, ext);
|
||||
}
|
||||
|
||||
if (internal || Zotero.MIME.fileHasInternalHandler(file))
|
||||
{
|
||||
window.loadURI(attachment.getLocalFileURL());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ Zotero.Attachments = new function(){
|
|||
// leaving the transaction open if the callback never triggers
|
||||
Zotero.DB.commitTransaction();
|
||||
|
||||
if (Zotero.MIME.isDocumentType(mimeType)) {
|
||||
if (mimeType == 'text/html') {
|
||||
Zotero.debug('Saving with saveDocument()');
|
||||
wbp.saveDocument(document, file, destDir, mimeType, encodingFlags, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ Zotero.MIME = new function(){
|
|||
this.sniffForBinary = sniffForBinary;
|
||||
this.getMIMETypeFromData = getMIMETypeFromData;
|
||||
this.getMIMETypeFromFile = getMIMETypeFromFile;
|
||||
this.isDocumentType = isDocumentType;
|
||||
this.hasNativeHandler = hasNativeHandler;
|
||||
this.hasInternalHandler = hasInternalHandler;
|
||||
this.fileHasInternalHandler = fileHasInternalHandler;
|
||||
|
|
@ -42,14 +41,6 @@ Zotero.MIME = new function(){
|
|||
["<?xml", 'text/xml']
|
||||
];
|
||||
|
||||
// MIME types to be saved as documents
|
||||
var _documentMIMETypes = {
|
||||
'text/html': true,
|
||||
'application/xhtml+xml': true,
|
||||
'text/xml': true,
|
||||
'application/xml': true
|
||||
};
|
||||
|
||||
// MIME types handled natively by Gecko
|
||||
// DEBUG: There's definitely a better way of getting these
|
||||
var _nativeMIMETypes = {
|
||||
|
|
@ -58,6 +49,8 @@ Zotero.MIME = new function(){
|
|||
'image/jpeg': true,
|
||||
'image/gif': true,
|
||||
'text/xml': true,
|
||||
'application/xhtml+xml': true,
|
||||
'application/xml': true,
|
||||
'text/plain': true,
|
||||
'application/x-javascript': true
|
||||
};
|
||||
|
|
@ -146,11 +139,6 @@ Zotero.MIME = new function(){
|
|||
}
|
||||
|
||||
|
||||
function isDocumentType(mimeType) {
|
||||
return _documentMIMETypes[mimeType] ? true : false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Determine if a MIME type can be handled natively
|
||||
* or if it needs to be passed off to a plugin or external helper app
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue