Skip to content

SCIX-942 fix(author-affiliation): download Excel export as binary - #951

Open
thostetler wants to merge 1 commit into
adsabs:masterfrom
thostetler:fix/scix-942-excel-export-binary
Open

thostetler wants to merge 1 commit into
adsabs:masterfrom
thostetler:fix/scix-942-excel-export-binary

Conversation

@thostetler

Copy link
Copy Markdown
Member

The author-affiliation Excel export downloaded a file Excel refused to open, because axios decoded the binary response as UTF-8 text before it reached the browser.

  • Excel exports are now requested as arraybuffer; useDownloadFile accepts BlobPart instead of only strings, so binary and string downloads both work.
  • jsdom's XHR corrupts binary the same way axios's old text path did, so tests pin axios' fetch adapter to cover the fetch logic; the real browser download was verified by hand against the live API.

Axios decoded the OLE2 response as UTF-8 and useDownloadFile re-encoded
it, replacing every invalid byte sequence with U+FFFD. Request the two
[excel] formats as arraybuffer and widen useDownloadFile to accept
BlobPart.

jsdom's XHR corrupts binary the same way, so tests pin axios' fetch
adapter; the browser path was verified by hand against the live API.
@thostetler
thostetler requested a review from shinyichen October 16, 2026 04:45
@github-actions

Copy link
Copy Markdown

Bundle size

Shared by all pages: 627.7 kB (+0.0 kB) ⚪

No route changed by more than 1 kB. ✅

First load = polyfills + shared _app chunks + route chunks, gzipped.

@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.2%. Comparing base (a815fbe) to head (4477602).

Files with missing lines Patch % Lines
src/lib/useDownloadFile.ts 70.0% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #951     +/-   ##
========================================
- Coverage    55.2%   55.2%   -0.0%     
========================================
  Files         378     379      +1     
  Lines       11618   11643     +25     
  Branches     2554    2554             
========================================
+ Hits         6406    6416     +10     
- Misses       4574    4586     +12     
- Partials      638     641      +3     
Files with missing lines Coverage Δ
src/api/author-affiliation/author-affiliation.ts 52.7% <100.0%> (ø)
src/components/AuthorAffiliations/models.ts 100.0% <100.0%> (ø)
src/lib/useDownloadFile.ts 80.4% <70.0%> (-1.0%) ⬇️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thostetler
thostetler marked this pull request as ready for review October 16, 2026 05:44

This branch has not been deployed

No deployments
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.

1 participant