diff --git a/activities/views/debug.py b/activities/views/debug.py index 568a3b4..4272aef 100644 --- a/activities/views/debug.py +++ b/activities/views/debug.py @@ -24,10 +24,13 @@ class JsonViewer(FormView): def form_valid(self, form): raw_result = "" + uri = form.cleaned_data["uri"] + if "://" not in uri: + uri = "https://" + uri try: response = async_to_sync(SystemActor().signed_request)( method="get", - uri=form.cleaned_data["uri"], + uri=uri, ) except httpx.RequestError: result = "Request Error" diff --git a/core/signatures.py b/core/signatures.py index 12e9e97..fba6b5a 100644 --- a/core/signatures.py +++ b/core/signatures.py @@ -183,6 +183,8 @@ class HttpSignature: Performs an async request to the given path, with a document, signed as an identity. """ + if "://" not in uri: + raise ValueError("URI does not contain a scheme") # Create the core header field set uri_parts = urlparse(uri) date_string = http_date() @@ -200,9 +202,7 @@ class HttpSignature: body_bytes = b"" # GET requests get implicit accept headers added if method == "get": - headers[ - "Accept" - ] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' + headers["Accept"] = "application/ld+json" # Sign the headers signed_string = "\n".join( f"{name.lower()}: {value}" for name, value in headers.items()