Skip to content

fix(service): await attachment reads during CSV export - #481

Open
newmanw wants to merge 1 commit into
ngageoint:developfrom
newmanw:fix/csv-export-attachment-async
Open

fix(service): await attachment reads during CSV export#481
newmanw wants to merge 1 commit into
ngageoint:developfrom
newmanw:fix/csv-export-attachment-async

Conversation

@newmanw

@newmanw newmanw commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • observation.attachments.forEach(async attachment => {...}) doesn't await its async callback, so exportColumn could return before attachment content had actually been read and appended to the export archive — attachments could be missing or incomplete in CSV exports depending on timing.
  • Replace the forEach with a for...of loop so each attachment's readContent/archive.append is properly awaited in order before the column is returned.

Test plan

  • Export an event with observations that have attachments to CSV and confirm all attachments are present in the resulting archive

Attachments were read with observation.attachments.forEach(async ...),
but forEach doesn't await its callback, so the CSV row/archive entry
was returned before attachment content had actually been read and
appended, causing attachments to be dropped or missing from CSV
exports. Use a for...of loop so each attachment is awaited in order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant