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