utkarsh134 commited on
Commit
39506f4
·
verified ·
1 Parent(s): 112b38a

Update api/routes.py

Browse files
Files changed (1) hide show
  1. api/routes.py +5 -2
api/routes.py CHANGED
@@ -77,13 +77,16 @@ async def get_candidate(candidate_id: str):
77
  try:
78
  from services.db_service import get_supabase_client
79
 
 
 
 
80
  supabase = get_supabase_client()
81
- response = supabase.table("candidates").select("*").eq("id", candidate_id).execute()
82
 
83
  if not response.data or len(response.data) == 0:
84
  raise HTTPException(
85
  status_code=status.HTTP_404_NOT_FOUND,
86
- detail=f"Candidate with ID {candidate_id} not found"
87
  )
88
 
89
  candidate_data = response.data[0]
 
77
  try:
78
  from services.db_service import get_supabase_client
79
 
80
+ # Clean the candidate_id by removing any quotes and decoding URL
81
+ clean_id = urllib.parse.unquote(candidate_id).strip('"')
82
+
83
  supabase = get_supabase_client()
84
+ response = supabase.table("candidates").select("*").eq("id", clean_id).execute()
85
 
86
  if not response.data or len(response.data) == 0:
87
  raise HTTPException(
88
  status_code=status.HTTP_404_NOT_FOUND,
89
+ detail=f"Candidate with ID {clean_id} not found"
90
  )
91
 
92
  candidate_data = response.data[0]