fix(pres_mgmt): increase file upload timeout to 20 min, guard null result

- Set post_object timeout to 1200000ms (20 min) for hosted file uploads;
  the 90s default was killing large presentation file uploads
- Guard result[0] access in .then() to prevent crash when upload
  times out or is aborted (TypeError: can't access property "hosted_file_id")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-22 00:36:14 -04:00
parent 2b2324ee8a
commit 18cbe256de

View File

@@ -153,11 +153,16 @@ async function handle_input_upload_files({
api_cfg: $ae_api,
endpoint: '/v3/action/hosted_file/upload',
form_data: form_data,
timeout: 1200000, // 20 minutes — large presentation files can be very slow to upload
task_id: task_id,
log_lvl: log_lvl
})
.then(async function (result) {
// WARNING: endpoint returns a list, we sequentially handle one at a time.
if (!result || !result[0]) {
console.error('Upload failed or timed out — no result returned.');
return false;
}
const hosted_file_obj = result[0];
const hosted_file_id = hosted_file_obj.hosted_file_id;