Fixes #607, Don't show annotations toolbar on MIME types it doesn't support
This commit is contained in:
parent
dd1eed6c9e
commit
f28cb22480
1 changed files with 12 additions and 1 deletions
|
@ -58,7 +58,18 @@ Zotero.Annotate = new function() {
|
|||
this.getAnnotationIDFromURL = function(url) {
|
||||
const attachmentRe = /^zotero:\/\/attachment\/([0-9]+)\/$/;
|
||||
var m = attachmentRe.exec(url);
|
||||
return m ? m[1] : false;
|
||||
if (m) {
|
||||
var id = m[1];
|
||||
var item = Zotero.Items.get(id);
|
||||
var mimeType = item.attachmentMIMEType;
|
||||
var file = item.getFile();
|
||||
var ext = Zotero.File.getExtension(file);
|
||||
if (mimeType == 'text/plain' || !Zotero.MIME.hasNativeHandler(mimeType, ext)) {
|
||||
return false;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue