Spaces:
Runtime error
Runtime error
Update api/routes.py
Browse files- 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",
|
| 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 {
|
| 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]
|