Skip to content

Brain submissions: label zip downloads with the customer name - #147

Open
rezakhadjavi wants to merge 1 commit into
mainfrom
runneth/brain-submissions-zip-customer-name
Open

Brain submissions: label zip downloads with the customer name#147
rezakhadjavi wants to merge 1 commit into
mainfrom
runneth/brain-submissions-zip-customer-name

Conversation

@rezakhadjavi

Copy link
Copy Markdown
Contributor

Reported by Josh: on the Brain submissions dashboard, downloading the data comes back as a zip with nothing identifying the customer.

Cause: both download paths were anonymous.

  • The single "Download all (.zip)" was named brain-submission-<id>.zip, folders inside were just section keys (brand_context/, personas/...).
  • The bulk "Download selected (.zip)" foldered files under sub-<id>/.
    Nothing surfaced the customer (workspace) name, so a saved zip looked blank/unlabelled.

Change:

  • Zip filename now leads with a customer-name slug (<customer>-brain-submission-<id>.zip; bulk uses <customer>-brain-files.zip when all selected files are from one customer, dated name when multiple).
  • Every file inside the zip now sits under a top-level folder named after the customer it came from. Bulk selections can span customers, so each file is foldered by its own submission's customer via a submissionId -> name map.
  • New getSubmissionNamesByIds / getSubmissionNameById db helpers.
  • Customer names are sanitised for both the header filename and the zip path so they can't break the download.
  • Tightened the archiver stream (attach the response before finalize() runs) to guard against an empty stream.

Typechecks clean (tsc --noEmit). No schema or data changes; download labelling only.

Leaving the merge to a human.

Single and bulk zip downloads were anonymous: the file was named
brain-submission-<id>.zip and the folders inside were just section
keys, so a downloaded zip had nothing tying it to the customer.

- zip filename now leads with a customer-name slug
- every file inside the zip sits under a top-level folder named after
  the customer it came from (bulk selections can span customers, so
  each file is foldered by its own submission's customer)
- add getSubmissionNamesByIds / getSubmissionNameById db helpers
- tighten the archiver stream so the response is attached before
  finalize() runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants