From d9336f2e476ba392b219e41dd4a4bb7dcfaaa002 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Sun, 1 Aug 2021 16:39:27 +0200 Subject: [PATCH] Use text HTTP response for serviceworker.js --- CHANGELOG.rst | 5 +++++ aleksis/core/views.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 72cc9090b..ab60608bd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,11 @@ Added * Allow to configure port for prometheus metrics endpoint. +Fixed +~~~~~ + +* Use text HTTP response for serviceworker.js insteas of binary stream + `2.0rc3`_ - 2021-07-26 ---------------------- diff --git a/aleksis/core/views.py b/aleksis/core/views.py index 416417406..fd42ba92e 100644 --- a/aleksis/core/views.py +++ b/aleksis/core/views.py @@ -15,7 +15,6 @@ from django.http import ( HttpResponseRedirect, JsonResponse, ) -from django.http.response import FileResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator @@ -128,7 +127,9 @@ class ServiceWorkerView(View): """ def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: - return FileResponse(open(settings.SERVICE_WORKER_PATH)) + return HttpResponse( + open(settings.SERVICE_WORKER_PATH, "rt"), content_type="application/javascript" + ) class ManifestView(View): -- GitLab