Skip to content
Snippets Groups Projects
Commit f7826ff0 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch '629-typeerror-unicode-objects-must-be-encoded-before-hashing' into 'master'

Resolve "PDF generation broken with S3 storage"

Closes #629

See merge request !931
parents 92de1aaf ca6ea202
No related branches found
No related tags found
1 merge request!931Resolve "PDF generation broken with S3 storage"
Pipeline #51707 canceled
......@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Fixed
~~~~~
* PDF generation failed with S3 storage due to incompatibility with boto3
`2.7`_ - 2022-01-24
-------------------
......
......@@ -5,6 +5,8 @@
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
<base href="{{ BASE_URL }}" />
{% include "core/partials/meta.html" %}
<title>
......
......@@ -216,6 +216,7 @@ def custom_information_processor(request: Union[HttpRequest, None]) -> dict:
"PWA_ICONS": regrouped_pwa_icons,
"SENTRY_ENABLED": settings.SENTRY_ENABLED,
"SITE_PREFERENCES": get_site_preferences(),
"BASE_URL": settings.BASE_URL,
}
if settings.SENTRY_ENABLED:
......
......@@ -79,7 +79,9 @@ def generate_pdf_from_template(
processed_context = context
html_template = render_to_string(template_name, processed_context, request)
file_object = PDFFile.objects.create(html_file=ContentFile(html_template, name="source.html"))
file_object = PDFFile.objects.create(
html_file=ContentFile(html_template.encode(), name="source.html")
)
# As this method may be run in background and there is no request available,
# we have to use a predefined URL from settings then
......
......@@ -28,6 +28,12 @@ AlekSIS allows you to configure an Amazon S3 endpoint for media
files. This is useful e.g. for loadbalancing with multiple AlekSIS
instances.
.. note::
For some background jobs, AlekSIS stores HTML snippets in the media
storage for later use. You must ensure your S3 endpoint is part of
your ``Access-Control-Allow-Origin`` CORS header, so HTML loaded from
there can load resources from the ALekSIS instance.
Configure an S3 endpoint
~~~~~~~~~~~~~~~~~~~~~~~~
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment