www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit f28cb224802f72ede5fc2afe24e062fc53827eaa
parent dd1eed6c9e6b8ec550953bfc315935c916f8efd1
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sun, 20 Dec 2009 09:30:26 +0000

Fixes #607, Don't show annotations toolbar on MIME types it doesn't support


Diffstat:
Mchrome/content/zotero/xpcom/annotate.js | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/annotate.js b/chrome/content/zotero/xpcom/annotate.js @@ -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; } /**