From 290e6fadb20a6987b538a43ce3d36db1b167d813 Mon Sep 17 00:00:00 2001
From: Kovid Goyal <kovid@kovidgoyal.net>
Date: Wed, 7 Aug 2019 19:44:21 +0530
Subject: [PATCH 39/71] Content server: Fix OPDS feed for category based
browsing listing restricted books, even though these books cannot be actually
downloaded. Fixes #1839173 [opds feed shows other books with same tags when
those books are not
allowed.](https://bugs.launchpad.net/calibre/+bug/1839173)
---
src/calibre/srv/opds.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/calibre/srv/opds.py b/src/calibre/srv/opds.py
index b9de203d25..e3bcb240a3 100644
--- a/src/calibre/srv/opds.py
+++ b/src/calibre/srv/opds.py
@@ -566,7 +566,7 @@ def opds_category(ctx, rd, category, which):
q = category
if q == 'news':
q = 'tags'
- ids = rc.db.get_books_for_category(q, which)
+ ids = rc.db.get_books_for_category(q, which) & rc.allowed_book_ids()
sort_by = 'series' if category == 'series' else 'title'
return get_acquisition_feed(rc, ids, offset, page_url, up_url, 'calibre-category:'+category+':'+unicode_type(which), sort_by=sort_by)