fix: build post URLs without a request context (v2.17.1)
Crossposting runs in a background worker; url_for there raised and every crosspost failed. post_url now joins SITE_URL and post_path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
191c99b59b
commit
6368365bd6
4 files changed
+23
-4
No files matched your search
+9
-2
@@ -722,8 +722,15 @@ def post_path(slug: str, title: Optional[str] = None) -> str:
|
||||
|
||||
|
||||
def post_url(slug: str, title: Optional[str] = None) -> str:
|
||||
"""A post's absolute URL (see post_path)"""
|
||||
return absolute_url_for("public.article" if title else "public.note", slug=slug)
|
||||
"""
|
||||
A post's absolute URL (see post_path)
|
||||
|
||||
Built from SITE_URL without url_for, so it works outside a request:
|
||||
crossposting and backfeed run in background workers (v2.17.0).
|
||||
"""
|
||||
from flask import current_app
|
||||
|
||||
return current_app.config["SITE_URL"].rstrip("/") + post_path(slug, title)
|
||||
|
||||
|
||||
def iso_utc(value) -> str:
|
||||
|
||||
Reference in new issue
Block a user