1
0
Fork 0

webhook: Server does not have a recent python, use optional[] instead of |

This commit is contained in:
root 2024-06-06 14:30:13 +00:00
parent f4f76ab972
commit 8f19e1dc36

View file

@ -9,6 +9,7 @@ import tempfile
import logging import logging
from pathlib import Path from pathlib import Path
from typing import Optional
from git import Actor, Repo, GitCommandError from git import Actor, Repo, GitCommandError
from sanic import HTTPResponse, Request, Sanic, response from sanic import HTTPResponse, Request, Sanic, response
@ -64,7 +65,7 @@ async def github_post(request: Request) -> HTTPResponse:
return response.json({"error": f"Unknown event '{event}'"}, 422) return response.json({"error": f"Unknown event '{event}'"}, 422)
def check_webhook_signatures(request: Request) -> HTTPResponse | None: def check_webhook_signatures(request: Request) -> Optional[HTTPResponse]:
logging.warning("Unsafe webhook!") logging.warning("Unsafe webhook!")
header_signature = request.headers.get("X-Hub-Signature") header_signature = request.headers.get("X-Hub-Signature")
if header_signature is None: if header_signature is None: