     Zotero.Server.DataListener.prototype._generateResponse = ((original) ->
       return (status, contentType, body) ->
         response = original.apply(this, arguments)
-        if Zotero.MIME.isTextType(contentType) || !body || !contentType
+        if !contentType || Zotero.MIME.isTextType(contentType) || !body
           return response
         else
           return {contentType: contentType, response: response}

      @add(summary: {type: 'text', '': abstr}) if abstr && abstr.length != 0

      for attachment in attachments
        Zotero.OPDS.log("attachment #{attachment.getFile().path} has type #{attachment.attachmentMIMEType} / #{Zotero.OPDS.nsIMIMEService.getTypeFromExtension(attachment.getFile().path.replace(/.*\./, ''))}"

        @add(link: {
          type: attachment.attachmentMIMEType || 'application/pdf'

      attachments = item.getAttachments() or []
      attachments = Zotero.Items.get(attachments) if attachments.length != 0
    Zotero.OPDS.log("'#{item.getDisplayTitle(true)}' has #{attachments.length} attachments")
    attachments = (a for a in attachments when a.attachmentLinkMode != Zotero.Attachments.LINK_MODE_LINKED_URL && a.attachmentMIMEType? != "text/html")
    Zotero.OPDS.log("'#{item.getDisplayTitle(true)}' has #{attachments.length} supported attachments")

    return if attachments.length == 0
