From cfa97b974036d359803d0c9ef6e04279f39b4018 Mon Sep 17 00:00:00 2001 From: Tyler Kennedy Date: Mon, 19 Dec 2022 06:21:04 -0500 Subject: [PATCH] Mitra Fixes (#207) Don't send a list when populating Accept header. This seems to work fine on Mastodon and friends, and fixes a bug with the Mitra server until resolved upstream. --- core/html.py | 2 +- core/signatures.py | 2 +- docker/Dockerfile | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/html.py b/core/html.py index dfb7beb..0ab6ace 100644 --- a/core/html.py +++ b/core/html.py @@ -20,7 +20,7 @@ def sanitize_post(post_html: str) -> str: Only allows a, br, p and span tags, and class attributes. """ cleaner = bleach.Cleaner( - tags=["br", "p"], + tags=["br", "p", "a"], attributes={ # type:ignore "a": allow_a, "p": ["class"], diff --git a/core/signatures.py b/core/signatures.py index 3dabb2d..5829c40 100644 --- a/core/signatures.py +++ b/core/signatures.py @@ -200,7 +200,7 @@ class HttpSignature: body_bytes = b"" # GET requests get implicit accept headers added if method == "get": - headers["Accept"] = "application/activity+json, application/ld+json" + headers["Accept"] = "application/activity+json" # Sign the headers signed_string = "\n".join( f"{name.lower()}: {value}" for name, value in headers.items() diff --git a/docker/Dockerfile b/docker/Dockerfile index a99c4f5..36f1820 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,6 +3,8 @@ ARG IMAGE_LABEL=3.11.1-slim-buster FROM ${IMAGE_HOST}:${IMAGE_LABEL} +ENV PYTHONUNBUFFERED=1 + RUN apt-get update \ && apt-get install -y --no-install-recommends \ libpq5 \