Skip to content

fix: preserve remote output subfolders#1277

Open
Kosinkadink wants to merge 4 commits into
mainfrom
fix/remote-output-subfolders
Open

fix: preserve remote output subfolders#1277
Kosinkadink wants to merge 4 commits into
mainfrom
fix/remote-output-subfolders

Conversation

@Kosinkadink

Copy link
Copy Markdown
Member

Summary

  • preserve WebSocket output subfolders when Content-Disposition provides a better filename
  • keep nested destinations across download retries and deduplication
  • strengthen path containment for traversal attempts and filesystem-root output directories
  • add regression coverage for nested image/video paths and retry completion

Fixes #1276

Testing

  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build
  • pnpm run test (195 files passed, 2884 tests passed, 1 skipped)

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Kosinkadink, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3f409bf3-d491-45b6-96b9-497870afe56b

📥 Commits

Reviewing files that changed from the base of the PR and between 658d4fc and d945bf6.

📒 Files selected for processing (2)
  • src/main/lib/comfyDownloadManager.test.ts
  • src/main/lib/comfyDownloadManager.ts
📝 Walkthrough

Walkthrough

Changes

Asset download path handling

Layer / File(s) Summary
Path resolution and containment
src/main/lib/comfyDownloadManager.ts, src/main/lib/comfyDownloadManager.test.ts
Adds sanitized nested-path resolution and stricter output-directory containment checks, including traversal, sibling-prefix, and filesystem-root cases.
Download destination and retry wiring
src/main/lib/comfyDownloadManager.ts
Preserves resolved subdirectories when rewriting download paths and stores output-relative retry filenames.
Lifecycle and filesystem validation
src/main/lib/comfyDownloadManager.test.ts
Simulates interrupted and retried downloads, verifies nested filename deduplication, and confirms the final file location.

Sequence Diagram(s)

sequenceDiagram
  participant ComfyUI
  participant startAssetDownload
  participant Electron
  participant resolveAssetSavePath
  participant FileSystem
  ComfyUI->>startAssetDownload: provide asset URL and initial save path
  startAssetDownload->>Electron: start managed download
  Electron->>resolveAssetSavePath: provide current path and Content-Disposition name
  resolveAssetSavePath-->>Electron: return contained nested destination
  resolveAssetSavePath->>FileSystem: create or use nested destination
  Electron-->>startAssetDownload: report interrupted or completed state
  startAssetDownload->>Electron: retry interrupted download
  Electron->>FileSystem: write retried asset and rename final file
Loading

Suggested reviewers: deepme987, maanilverma

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR preserves nested remote output subfolders for auto-downloads, matching the issue’s expected output/video/ltx/ behavior.
Out of Scope Changes check ✅ Passed The changes stay focused on path preservation, containment, and retry handling for remote auto-downloads; no unrelated scope is evident.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/remote-output-subfolders
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/remote-output-subfolders

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested review from MaanilVerma and deepme987 July 17, 2026 14:37
@Kosinkadink

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

Remote output auto-download drops subfolder structure

1 participant