From f34ece7c14de959f90fb4a596e3e70335b82bbb7 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Mon, 11 Sep 2023 13:33:45 +0200 Subject: [PATCH] fix sane url --- backend/app/sane_url.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/app/sane_url.py b/backend/app/sane_url.py index 418847d8e..e20cfed1c 100644 --- a/backend/app/sane_url.py +++ b/backend/app/sane_url.py @@ -126,13 +126,12 @@ data_proxy_store = SaneUrlDPStore() @router.get("/{short_id:str}") async def get_short(short_id:str, request: Request): try: - resp = data_proxy_store.get(short_id) - resp_json = json.loads(resp) + existing_value = data_proxy_store.get(short_id) accept = request.headers.get("Accept") if "text/html" in accept: - hashed_path = resp_json.get("hashPath") + hashed_path = existing_value.get("hashPath") return RedirectResponse(f"{HOST_PATHNAME}/#{hashed_path}") - return JSONResponse(resp_json) + return JSONResponse(existing_value) except DataproxyStore.NotFound as e: raise HTTPException(404, str(e)) except DataproxyStore.GenericException as e: -- GitLab