Skip to content

Commit 9a34143

Browse files
[Bug] A 500 Internal Server Error occurs when an API request is made to a book without any formats.
Fixes #925
1 parent 2206341 commit 9a34143

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

CONTRIBUTORS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ Copyright (C) 2024-2026 Calibre-Web Automated contributors
313313
- zelazna (1 commits)
314314
- zhiyue (1 commits)
315315
# Fork Contributors (crocodilestick/calibre-web-automated)
316-
- crocodilestick (931 commits)
316+
317+
- crocodilestick (946 commits)
317318
- jmarmstrong1207 (73 commits)
318319
- demitrix (30 commits)
319320
- sirwolfgang (29 commits)
@@ -337,6 +338,7 @@ Copyright (C) 2024-2026 Calibre-Web Automated contributors
337338
- stewie83 (3 commits)
338339
- zikasak (3 commits)
339340
- aaronpowell (2 commits)
341+
- BrachiumX (2 commits)
340342
- chad3814 (2 commits)
341343
- coissac (2 commits)
342344
- FennyFatal (2 commits)
@@ -382,6 +384,7 @@ Copyright (C) 2024-2026 Calibre-Web Automated contributors
382384
- jeffonthemove (1 commits)
383385
- jspiers (1 commits)
384386
- kevpam (1 commits)
387+
- KucharczykL (1 commits)
385388
- lazyusername (1 commits)
386389
- Lee Nave (anon) (1 commits)
387390
- marauder37 (1 commits)
@@ -396,6 +399,7 @@ Copyright (C) 2024-2026 Calibre-Web Automated contributors
396399
- rjaakke (1 commits)
397400
- robinwo (1 commits)
398401
- Rustymage (1 commits)
402+
- Seth Milliken (anon) (1 commits)
399403
- smathev (1 commits)
400404
- spezzino (1 commits)
401405
- stadler-pascal (1 commits)

cps/templates/json.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
"uuid": {{ entry.uuid | tojson }},
3636
"timestamp": {{ entry.timestamp | string | tojson }},
3737
"thumbnail": {{ url_for('opds.feed_get_cover', book_id=entry.id) | tojson }},
38-
"main_format": {
38+
"main_format": {% if entry.data.__len__() > 0 %}{
3939
{{ entry.data[0].format|lower | tojson }}: {{ url_for('opds.opds_download_link', book_id=entry.id, book_format=entry.data[0].format|lower) | tojson }}
40-
},
40+
}{% else %}{}{% endif %},
4141
"rating": {% if entry.ratings.__len__() > 0 %}{{ (entry.ratings[0].rating|string + ".0") | tojson }}{% else %}0.0{% endif %},
4242
"authors": [
4343
{% for author in entry.authors %}

0 commit comments

Comments
 (0)