From: Radek Czajka <rczajka@rczajka.pl>
Date: Sat, 11 Dec 2021 13:33:55 +0000 (+0100)
Subject: Librarian update.
X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/cc489b0c8d9ed514fddd5ccb81c9c1f62666663f

Librarian update.
---

diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 1ff1b461..db084ea2 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -10,7 +10,7 @@ python-slugify
 python-docx==0.8.10
 Wikidata==0.6.1
 
-librarian==1.10
+librarian==2.2
 
 ## Django
 Django==3.1.13
diff --git a/src/documents/views.py b/src/documents/views.py
index 0a9c0982..bfcd0139 100644
--- a/src/documents/views.py
+++ b/src/documents/views.py
@@ -273,7 +273,7 @@ def book_pdf(request, slug, mobile=False):
     doc = book.wldocument()
     # TODO: error handling
     customizations = ['26pt', 'nothemes', 'nomargins', 'notoc'] if mobile else None
-    pdf_file = doc.as_pdf(cover=True, ilustr_path=book.gallery_path(), customizations=customizations)
+    pdf_file = doc.as_pdf(cover=True, base_url=request.build_absolute_uri(book.gallery_path()), customizations=customizations)
     from .ebook_utils import serve_file
     return serve_file(pdf_file.get_filename(),
                 book.slug + '.pdf', 'application/pdf')
@@ -288,7 +288,7 @@ def book_epub(request, slug):
     # TODO: move to celery
     doc = book.wldocument()
     # TODO: error handling
-    epub = doc.as_epub(ilustr_path=book.gallery_path()).get_bytes()
+    epub = doc.as_epub(base_url=request.build_absolute_uri(book.gallery_path())).get_bytes()
     response = HttpResponse(content_type='application/epub+zip')
     response['Content-Disposition'] = 'attachment; filename=%s' % book.slug + '.epub'
     response.write(epub)
@@ -304,7 +304,7 @@ def book_mobi(request, slug):
     # TODO: move to celery
     doc = book.wldocument()
     # TODO: error handling
-    mobi = doc.as_mobi(ilustr_path=book.gallery_path()).get_bytes()
+    mobi = doc.as_mobi(base_url=request.build_absolute_uri(book.gallery_path())).get_bytes()
     response = HttpResponse(content_type='application/x-mobipocket-ebook')
     response['Content-Disposition'] = 'attachment; filename=%s' % book.slug + '.mobi'
     response.write(mobi)