       @add(summary: {type: 'text', '': abstr}) if abstr && abstr.length != 0
 
       for attachment in attachments
-        Zotero.OPDS.log("attachment #{attachment.getFilename()} has type #{attachment.attachmentMIMEType} / #{Zotero.OPDS.MIMEService.getTypeFromExtension(attachment.getFilename().replace(/.*\./, ''))}")
+        Zotero.OPDS.log("attachment #{attachment.getFilename()} has type #{Zotero.OPDS.contentType(attachment)}")
 
         @add(link: {
-          type: attachment.attachmentMIMEType || 'application/pdf'
+          type: Zotero.OPDS.contentType(attachment)
           rel: 'http://opds-spec.org/acquisition'
           href: "/opds/item?library=#{attachment.libraryID || 0}&key=#{attachment.key}"
           })

  document: Components.classes["@mozilla.org/xul/xul-document;1"].getService(Components.interfaces.nsIDOMDocument)
  serializer: Components.classes["@mozilla.org/xmlextras/xmlserializer;1"].createInstance(Components.interfaces.nsIDOMSerializer)
  parser: Components.classes["@mozilla.org/xmlextras/domparser;1"].createInstance(Components.interfaces.nsIDOMParser)
  MIMEService: Components.classes['@mozilla.org/uriloader/external-helper-app-service;1'].getService(Components.interfaces.nsIMIMEService)
  # xslt: Components.classes["@mozilla.org/document-transformer;1?type=xslt"].createInstance(Components.interfaces.nsIXSLTProcessor)

  clients:

      init: (url, data, sendResponseCallback) ->
        item = Zotero.Items.getByLibraryAndKey(url.query.library, url.query.key)
        body = Zotero.File.getBinaryContents(item.getFile())
        sendResponseCallback(200, Zotero.OPDS.contentType(item) || 'application/pdf', body)

    group:
      supportedMethods: ["GET"]
