Skip to content

Commit e3a38ef

Browse files
fix: create path correctly (#82)
Doing string manipulation breaks with queries in url.
1 parent e4f620d commit e3a38ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def dicthash(data: dict) -> str:
3636

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

4242

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

0 commit comments

Comments
 (0)