Skip to content

Commit c9ee8d7

Browse files
committed
fix(opds): generalize numberOfItems fallback for non-stream links
1 parent 03f8747 commit c9ee8d7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

opds.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ const getLink = link => {
138138

139139
const isAcquisition = rel?.some(r => r.startsWith(REL.ACQ) || r === 'preview')
140140
const isStream = rel?.includes(REL.STREAM)
141-
const isFacet = rel?.includes(REL.FACET)
142141

143142
// Map OPDS 1.x active facets to OPDS 2.0 "self" link
144143
const activeFacet = link.getAttributeNS(NS.OPDS, 'activeFacet') || link.getAttribute('opds:activeFacet')
@@ -165,7 +164,7 @@ const getLink = link => {
165164
price: (isAcquisition || isStream) ? getPrice(link) : undefined,
166165
indirectAcquisition: (isAcquisition || isStream) ? getIndirectAcquisition(link) : undefined,
167166
// --- Pagination / Facet Counters ---
168-
numberOfItems: thrCount != null ? Number(thrCount) : (isFacet && fallbackCount != null) ? Number(fallbackCount) : undefined,
167+
numberOfItems: thrCount != null ? Number(thrCount) : (!isStream && fallbackCount != null) ? Number(fallbackCount) : undefined,
169168
'pse:count': isStream && (pseCount ?? fallbackCount) != null ? Number(pseCount ?? fallbackCount) : undefined,
170169
'pse:lastRead': isStream && pseLastRead != null ? Number(pseLastRead) : undefined,
171170
'pse:lastReadDate': isStream ? pseLastReadDate ?? undefined : undefined,

0 commit comments

Comments
 (0)