From fde729d474e06f4445284714d6b6bba1226b1c31 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 3 Feb 2026 14:42:24 -0500 Subject: [PATCH] feat(hosted-file): add archive_content to intelligent download ID resolution --- app/routers/api_v3_actions_hosted_file.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/routers/api_v3_actions_hosted_file.py b/app/routers/api_v3_actions_hosted_file.py index 6ba7225..c3e6737 100644 --- a/app/routers/api_v3_actions_hosted_file.py +++ b/app/routers/api_v3_actions_hosted_file.py @@ -210,15 +210,23 @@ async def download_file_action( # 2. Resolve File Record # ID Vision: Attempt to resolve the ID. - # If not found in hosted_file, check if it's an event_file ID that we can resolve to a hosted_file. + # If not found in hosted_file, check if it's an event_file or archive_content ID that we can resolve. resolved_id = redis_lookup_id_random(record_id_random=hosted_file_id, table_name='hosted_file') if not resolved_id: - log.info(f"ID {hosted_file_id} not found in hosted_file. Checking event_file...") + log.info(f"ID {hosted_file_id} not found in hosted_file. Checking container tables...") + # A. Check event_file if ef_id := redis_lookup_id_random(record_id_random=hosted_file_id, table_name='event_file'): if ef_rec := sql_select(sql="SELECT hosted_file_id FROM event_file WHERE id = :id", data={'id': ef_id}): resolved_id = ef_rec.get('hosted_file_id') log.info(f"Resolved event_file {hosted_file_id} to hosted_file {resolved_id}") + + # B. Check archive_content + if not resolved_id: + if ac_id := redis_lookup_id_random(record_id_random=hosted_file_id, table_name='archive_content'): + if ac_rec := sql_select(sql="SELECT hosted_file_id FROM archive_content WHERE id = :id", data={'id': ac_id}): + resolved_id = ac_rec.get('hosted_file_id') + log.info(f"Resolved archive_content {hosted_file_id} to hosted_file {resolved_id}") if not resolved_id: raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Hosted file record not found.")