Fix for Attachment File Type advanced search condition not finding any results for some types (e.g. "Image")

This commit is contained in:
Dan Stillman 2007-10-22 23:39:01 +00:00
parent 5f64852cf8
commit 96a95f0e1c

View File

@ -889,10 +889,22 @@ Zotero.Search.prototype._buildQuery = function(){
break;
case 'fileTypeID':
condSQL += 'mimeType IN (SELECT mimeType FROM '
+ 'fileTypeMimeTypes WHERE fileTypeID IN ('
+ 'SELECT fileTypeID FROM fileTypes WHERE ';
openParens = openParens + 2;
var ftSQL = 'SELECT mimeType FROM fileTypeMimeTypes '
+ 'WHERE fileTypeID IN ('
+ 'SELECT fileTypeID FROM fileTypes WHERE '
+ 'fileTypeID=?)';
var patterns = Zotero.DB.columnQuery(ftSQL, { int: condition.value });
if (patterns) {
for each(str in patterns) {
condSQL += 'mimeType LIKE ? OR ';
condSQLParams.push(str + '%');
}
condSQL = condSQL.substring(0, condSQL.length - 4);
}
else {
throw ("Invalid fileTypeID '" + condition.value + "' specified in search.js")
}
skipOperators = true;
break;
case 'tag':