From f9c61dad23e456380538bdb1f9b1543176100ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 9 Dec 2019 14:04:14 +0200 Subject: [PATCH] Fix List-Unsubscribe email header value: add angle brackets --- CHANGELOG.md | 3 ++- hc/accounts/models.py | 2 +- hc/api/transports.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77c6ed06..1f6ac963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ All notable changes to this project will be documented in this file. - Added JSON endpoint for Shields.io (#304) ### Bug Fixes -- Don't set CSRF cookie on first visit. Signup is exempt from CSRF protection. +- Don't set CSRF cookie on first visit. Signup is exempt from CSRF protection +- Fix List-Unsubscribe email header value: add angle brackets ## v1.11.0 - 2019-11-22 diff --git a/hc/accounts/models.py b/hc/accounts/models.py index 31994c60..cb0cb3a2 100644 --- a/hc/accounts/models.py +++ b/hc/accounts/models.py @@ -174,7 +174,7 @@ class Profile(models.Model): unsub_url = self.reports_unsub_url() - headers = {"List-Unsubscribe": unsub_url, "X-Bounce-Url": unsub_url} + headers = {"List-Unsubscribe": "<%s>" % unsub_url, "X-Bounce-Url": unsub_url} ctx = { "checks": checks, diff --git a/hc/api/transports.py b/hc/api/transports.py index 6731e70a..4d3cef91 100644 --- a/hc/api/transports.py +++ b/hc/api/transports.py @@ -61,7 +61,7 @@ class Email(Transport): unsub_link = self.channel.get_unsub_link() - headers = {"X-Bounce-Url": bounce_url, "List-Unsubscribe": unsub_link} + headers = {"X-Bounce-Url": bounce_url, "List-Unsubscribe": "<%s>" % unsub_link} try: # Look up the sorting preference for this email address