From 48bc52899fe9d2b79961a52264549cf99922ef35 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 10 Jun 2026 14:41:53 -0400 Subject: [PATCH] fix(pres_mgmt): switch direct download links to event_file endpoint event_file ?key= auth fix is now deployed. Retire the hosted_file workaround and use /v3/action/event_file/{event_file_id}/download?key=... as the canonical form across the file downloads report, manage file list, and download button. Co-Authored-By: Claude Sonnet 4.6 --- .../ae_comp__hosted_files_download_button.svelte | 12 ++++++------ src/lib/elements/element_manage_event_file_li.svelte | 4 ++-- .../reports/reports_file_downloads.svelte | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte b/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte index 22cfb613..fadfdf70 100644 --- a/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte +++ b/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte @@ -186,12 +186,12 @@ let is_url_file = $derived.by(() => { let direct_download_url = $derived.by(() => { if (!show_direct_download || !hosted_file_obj) return ''; - // Always use the hosted_file endpoint — it supports ?key= auth and resolves event_file - // IDs automatically via Redis. The event_file endpoint's ?key= support is not yet deployed. - const file_id = - hosted_file_obj.hosted_file_id || - hosted_file_obj.event_file_id || - hosted_file_id; + // Use event_file endpoint when event_file_id is present (canonical per API guide §5). + // Fall back to hosted_file endpoint for standalone hosted_file objects. + if (hosted_file_obj.event_file_id) { + return `${$ae_api.base_url}/v3/action/event_file/${hosted_file_obj.event_file_id}/download?filename=${ae_util.clean_filename(final_filename)}&key=${$ae_api.account_id}`; + } + const file_id = hosted_file_obj.hosted_file_id || hosted_file_id; return `${$ae_api.base_url}/v3/action/hosted_file/${file_id}/download?filename=${ae_util.clean_filename(final_filename)}&key=${$ae_api.account_id}`; }); diff --git a/src/lib/elements/element_manage_event_file_li.svelte b/src/lib/elements/element_manage_event_file_li.svelte index ea0a3be1..a0f4f8fc 100644 --- a/src/lib/elements/element_manage_event_file_li.svelte +++ b/src/lib/elements/element_manage_event_file_li.svelte @@ -317,7 +317,7 @@ async function handle_convert_pdf_to_image(event_file_obj: key_val) {