Skip to content

FIREFLY-2064: Failed to save large downloads - #2023

Merged
loitly merged 2 commits into
devfrom
FIREFLY-2064-large-file-download
Sep 25, 2026
Merged

loitly merged 2 commits into
devfrom
FIREFLY-2064-large-file-download

Conversation

@loitly

@loitly loitly commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Ticket: https://jira.ipac.caltech.edu/browse/FIREFLY-2064

  • switch response.blob() to iframe form post
  • fix suggested name to support additional standards

Test: Normal table/image save functions
https://firefly-2064-large-file-download.irsakubedev.ipac.caltech.edu/firefly/

  • Upload a large table or fits file
  • Save the table or fits image

Test: Downloading a large zip file.
https://firefly-2064-large-file-download.irsakubedev.ipac.caltech.edu/applications/Spitzer/SHA/

  • Search by Position -> m81
  • Select a couple of AOR, then download everything including ancillary
  • Job Monitor -> click download once it's completed.

- switch response.blob() to iframe form post
- fix suggested name to support additional standards
@loitly loitly added this to the 2026.3 milestone Sep 24, 2026
@loitly
loitly requested review from robyww and a lite review from Copilot September 24, 2026 21:32
@loitly loitly self-assigned this Sep 24, 2026
@loitly loitly added the bug label Sep 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Moderate filename parsing and download error-handling issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Medium severity

Open (3)
What changed in this PR

This PR changes large-file downloads to stream through iframe/form submissions and improves filename handling and download status tracking.

Changes:

  • Adds cookie-based download-start detection.
  • Updates table and job-monitor download flows.
  • Adds RFC-style Content-Disposition handling.

Review findings:

  • URLDownload.java: escaped quotes in filenames are not parsed correctly.
  • fetch.js and JobMonitor.jsx: websocket setup failures can leave jobs stuck in WORKING with unhandled rejections.
File Summary
src/​firefly/​test/​edu/​caltech/​ipac/​util/​download/​URLDownloadTest.java Tests filename header behavior.
src/​firefly/​js/​util/​fetch.js Implements iframe downloads and cookie polling.
src/​firefly/​js/​tables/​ui/​TableSave.jsx Tracks table download preparation and completion.
src/​firefly/​js/​core/​background/​JobMonitor.jsx Updates download status handling.
src/​firefly/​java/​edu/​caltech/​ipac/​util/​download/​URLDownload.java Adds filename parsing and header generation.
src/​firefly/​java/​edu/​caltech/​ipac/​firefly/​server/​servlets/​HttpServCommands.java Adds download headers and startup cookies.
src/​firefly/​java/​edu/​caltech/​ipac/​firefly/​server/​servlets/​CommandService.java Resets download responses on errors.
src/​firefly/​java/​edu/​caltech/​ipac/​firefly/​server/​servlets/​AnyFileDownload.java Adds download cookies and safe headers.
src/​firefly/​java/​edu/​caltech/​ipac/​firefly/​server/​RequestAgent.java Supports websocket metadata from query parameters.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/firefly/java/edu/caltech/ipac/util/download/URLDownload.java
Comment thread src/firefly/js/core/background/JobMonitor.jsx
Comment thread src/firefly/js/util/fetch.js

@robyww robyww left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a some little things, that you might want to checkout before you merge. Otherwise it looks good.

Comment thread src/firefly/java/edu/caltech/ipac/firefly/server/RequestAgent.java
showInfoPopup(truncate(message, {length: 200}), 'Unexpected error');
return await Promise.race([
waitForCookie(DOWNLOAD_COOKIE_PREFIX + token, () => stopped).then(() => true),
failed.then(() => false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting code. Took some study to understand.

Comment thread src/firefly/js/util/fetch.js
Comment thread src/firefly/js/util/fetch.js Outdated
@loitly
loitly merged commit 8acff57 into dev Sep 25, 2026
1 check passed
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.

3 participants