webhook: Server does not have a recent python, use optional[] instead of |
This commit is contained in:
parent
f4f76ab972
commit
8f19e1dc36
1 changed files with 2 additions and 1 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue