diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 1a37070f3..1b631ea73 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -1230,7 +1230,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { var patterns = yield Zotero.DB.columnQueryAsync(ftSQL, { int: condition.value }); if (patterns) { for each(str in patterns) { - condSQL += 'mimeType LIKE ? OR '; + condSQL += 'contentType LIKE ? OR '; condSQLParams.push(str + '%'); } condSQL = condSQL.substring(0, condSQL.length - 4); diff --git a/test/tests/searchTest.js b/test/tests/searchTest.js index 496c98071..6d639ab93 100644 --- a/test/tests/searchTest.js +++ b/test/tests/searchTest.js @@ -146,6 +146,13 @@ describe("Zotero.Search", function() { let matches = yield s.search(); assert.deepEqual(matches, [foobarItem.id]); }); + + it("should search by attachment file type", function* () { + let s = new Zotero.Search(); + s.addCondition('fileTypeID', 'is', Zotero.FileTypes.getID('webpage')); + let matches = yield s.search(); + assert.sameMembers(matches, [fooItem.id, foobarItem.id]); + }); }); describe("#toJSON()", function () {