Skip to content

Commit

Permalink
fix: create path correctly
Browse files Browse the repository at this point in the history
Doing string manipulation breaks with queries in url.
  • Loading branch information
lavirlifiliol committed Jul 5, 2024
1 parent e4f620d commit 3ff33b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def dicthash(data: dict) -> str:

def make_file_path(dh: str, request_url: URL) -> str:
"""Build a file path from dict_hash and a URL."""
fqdn = str(request_url).removesuffix(request_url.path)
return f"{fqdn}/static/{dh}.png"
path = f"/static/{dh}.png"
return str(request_url.replace(query="", path=path))


@app.get("/duck", status_code=201)
Expand Down

0 comments on commit 3ff33b1

Please sign in to comment.