Skip to content

Commit

Permalink
Update api.py
Browse files Browse the repository at this point in the history
Use unquote to handle special characters on url that is used as input parameter
  • Loading branch information
vgole001 authored Jun 7, 2024
1 parent 3c9131e commit 7bde6bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ async def get_non_empty_warnings():
# Endpoint to retrieve data with client error statuses
@app.get('/status/{item:path}', response_model=List[StatusResponse])
async def get_status_for_url(item):
decoded_item = unquote(item)
query = "SELECT * FROM linkchecker_output WHERE urlname = :item"
data = await fetch_data(query=query, values={'item': item })
data = await fetch_data(query=query, values={'item': decoded_item })
return data

# Start the application
Expand All @@ -110,4 +111,4 @@ async def shutdown():
try:
await database.disconnect()
except Exception as e:
raise HTTPException(status_code=500, detail="Database disconnection failed") from e
raise HTTPException(status_code=500, detail="Database disconnection failed") from e

0 comments on commit 7bde6bb

Please sign in to comment.