Skip to content
Snippets Groups Projects
Commit e5d7cab3 authored by Xiao Gui's avatar Xiao Gui
Browse files

fix saneurl

parent f34ece7c
No related branches found
No related tags found
No related merge requests found
......@@ -127,11 +127,12 @@ data_proxy_store = SaneUrlDPStore()
async def get_short(short_id:str, request: Request):
try:
existing_value = data_proxy_store.get(short_id)
existing_json = json.loads(existing_value)
accept = request.headers.get("Accept")
if "text/html" in accept:
hashed_path = existing_value.get("hashPath")
hashed_path = existing_json.get("hashPath")
return RedirectResponse(f"{HOST_PATHNAME}/#{hashed_path}")
return JSONResponse(existing_value)
return JSONResponse(existing_json)
except DataproxyStore.NotFound as e:
raise HTTPException(404, str(e))
except DataproxyStore.GenericException as e:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment