Skip to content

fix(debrid): Preserve folder size for fallback service-wrapped streams#941

Open
jakubschenk wants to merge 1 commit into
Viren070:mainfrom
jakubschenk:fix/service-wrap-folder-size
Open

fix(debrid): Preserve folder size for fallback service-wrapped streams#941
jakubschenk wants to merge 1 commit into
Viren070:mainfrom
jakubschenk:fix/service-wrap-folder-size

Conversation

@jakubschenk

@jakubschenk jakubschenk commented May 11, 2026

Copy link
Copy Markdown

Summary

  • Keep the original parsed stream file size and folder size when a wrapped debrid result falls back to a synthetic selected file.
  • Preserve file-vs-folder metadata for folder torrents when the debrid service response does not expose or select a concrete file.

Verification

  • pnpm -F core exec prettier --write src/main/serviceWrapper.ts
  • pnpm -F core build

Summary by CodeRabbit

  • Bug Fixes
    • Improved stream data handling by implementing fallback logic for size calculations, ensuring more accurate values are used when processing specific stream scenarios.

Review Change Stack

@jakubschenk jakubschenk changed the title Preserve folder size for fallback service-wrapped streams fix(debrid): Preserve folder size for fallback service-wrapped streams May 11, 2026
@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The buildDebridStreams function now computes size and folderSize values with fallback logic that prefers the originating stream's values when result.file.index === -1, rather than always using result properties directly. These computed values are then assigned to the constructed ParsedStream object.

Changes

Stream Size Fallback Logic

Layer / File(s) Summary
Size Computation Logic
packages/core/src/main/serviceWrapper.ts
Introduces local size and folderSize variables that conditionally select between original.size / original.folderSize and result.file.size / result.size based on whether result.file.index === -1.
ParsedStream Construction
packages/core/src/main/serviceWrapper.ts
Updates the debridStream object assignment to use the newly computed size and folderSize variables instead of directly accessing result.file.size and result.size.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A stream's true size now has a second sight, 🐰
When indices fall to minus one's night,
We fetch the original, when it's there,
A fallback that shows the utmost care.
Small logic blooms with fallback's gentle flair! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and specifically describes the main change: preserving folder size for fallback service-wrapped streams when handling synthetic files with index === -1.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

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