Skip to content

Commit

Permalink
Add proper scheme (not default to https)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Jul 15, 2024
1 parent 29e207c commit 68c40e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ async def security_info(self, request: starlette_plus.Request) -> starlette_plus
status_code=404,
)

delete: str = f"https://{request.url.hostname}/api/security/delete/{token}"
info: str = f"https://{request.url.hostname}/api/security/info/{token}"
delete: str = f"{request.url.scheme}://{request.url.hostname}/api/security/delete/{token}"
info: str = f"{request.url.scheme}://{request.url.hostname}/api/security/info/{token}"
data: dict[str, str] = {
"token": paste.safety,
"delete": delete,
Expand Down
2 changes: 1 addition & 1 deletion views/htmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ async def paste_raw(self, request: starlette_plus.Request) -> starlette_plus.Res

htmx_url: str | None = request.headers.get("HX-Current-URL", None)
if identifier == "0" and htmx_url:
identifier = htmx_url.removeprefix(f"https://{request.url.hostname}/")
identifier = htmx_url.removeprefix(f"{request.url.scheme}://{request.url.hostname}/")

headers: dict[str, str] = {"HX-Redirect": f"/raw/{identifier}"}
paste = await self.app.database.fetch_paste(identifier, password=password)
Expand Down

0 comments on commit 68c40e7

Please sign in to comment.