fix mastodon post encoding

This commit is contained in:
Jonas Heinrich 2025-05-10 13:12:28 +02:00
parent 27a4b1a094
commit a7ef35cb0f

View file

@ -5,10 +5,12 @@ from django.db import transaction
from mastodon import Mastodon
from .models import GovernmentPlanUpdate, GovernmentPlan
import re
import html
def strip_html_tags(text):
tag_re = re.compile(r'<[^>]+>')
return tag_re.sub('', text).decode('utf-8')
plain_text = tag_re.sub('', text)
return html.unescape(plain_text)
def post_to_mastodon(text):
mastodon = Mastodon(