Fix sign_request call in AP delivery handler

Parse inbox URL into path+host instead of passing url= which doesn't exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-21 22:52:30 +00:00
parent 1d83a339b6
commit 68941b97f6

View File

@@ -53,17 +53,20 @@ async def _deliver_to_inbox(
) -> bool:
"""POST signed activity to a single inbox. Returns True on success."""
from shared.utils.http_signatures import sign_request
from urllib.parse import urlparse
import json
body_bytes = json.dumps(body).encode()
key_id = f"https://{domain}/users/{actor.preferred_username}#main-key"
parsed = urlparse(inbox_url)
headers = sign_request(
method="POST",
url=inbox_url,
body=body_bytes,
private_key_pem=actor.private_key_pem,
key_id=key_id,
method="POST",
path=parsed.path,
host=parsed.netloc,
body=body_bytes,
)
headers["Content-Type"] = AP_CONTENT_TYPE