mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-03-10 11:53:41 -04:00
A few more locations to disallow template based searches
This commit is contained in:
parent
fdab1d476a
commit
3f7fc2cf5b
@ -33,7 +33,7 @@ def fts_search(ctx, rd):
|
||||
ans['query_id'] = qid
|
||||
book_ids = None
|
||||
if rd.query.get('restriction'):
|
||||
book_ids = db.search('', restriction=rd.query.get('restriction'))
|
||||
book_ids = db.search('', restriction=rd.query.get('restriction'), allow_templates=False)
|
||||
|
||||
def add_metadata(result):
|
||||
result.pop('id', None)
|
||||
|
||||
@ -86,7 +86,7 @@ class Context:
|
||||
restriction = self.restriction_for(request_data, db)
|
||||
if restriction:
|
||||
try:
|
||||
return book_id in db.search('', restriction=restriction)
|
||||
return book_id in db.search('', restriction=restriction, allow_templates=False)
|
||||
except ParseException:
|
||||
return False
|
||||
return db.has_id(book_id)
|
||||
@ -95,12 +95,12 @@ class Context:
|
||||
restriction = self.restriction_for(request_data, db)
|
||||
allowed_book_ids = None
|
||||
if restriction:
|
||||
allowed_book_ids = db.search('', restriction=restriction)
|
||||
allowed_book_ids = db.search('', restriction=restriction, allow_templates=False)
|
||||
return db.newly_added_book_ids(count=count, book_ids=allowed_book_ids)
|
||||
|
||||
def get_allowed_book_ids_from_restriction(self, request_data, db):
|
||||
restriction = self.restriction_for(request_data, db)
|
||||
return frozenset(db.search('', restriction=restriction)) if restriction else None
|
||||
return frozenset(db.search('', restriction=restriction, allow_templates=False)) if restriction else None
|
||||
|
||||
def allowed_book_ids(self, request_data, db):
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user