Skip to content
Snippets Groups Projects
Verified Commit 104bad65 authored by TheJoeCoder's avatar TheJoeCoder
Browse files

Prevent error on trying to access epubs without progress

parent 4a7aebd2
No related branches found
No related tags found
No related merge requests found
...@@ -158,10 +158,12 @@ def read_book(request, book_id): ...@@ -158,10 +158,12 @@ def read_book(request, book_id):
case "epub": case "epub":
reader_template = "reader/book_read/epub_viewer.html" reader_template = "reader/book_read/epub_viewer.html"
# Try to parse CFI # Try to parse CFI
if userbook.last_progress_cfi is not None:
rgx = re.compile(r"epubcfi\((.*)\)") rgx = re.compile(r"epubcfi\((.*)\)")
m = rgx.match(userbook.last_progress_cfi) m = rgx.match(userbook.last_progress_cfi)
if m: if m:
cfi_ref = userbook.last_progress_cfi cfi_ref = userbook.last_progress_cfi
case _: case _:
reader_template = "reader/book_read/invalid_filetype.html" reader_template = "reader/book_read/invalid_filetype.html"
return render(request, reader_template, { return render(request, reader_template, {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment