Fix: Don't report dynamix.cfg as corrupt if 0 byte file#2386
Conversation
|
@coderabbitai review me |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
|
@coderabbitai Are you alive or just giving me the silent treatment? |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughAdds a conditional guard in the plugin config validation loop to skip zero-length, non-required plugin config files, altering the inner control flow to continue rather than flagging them as missing/invalid. Other existence, parsing, retry, and sleep behaviors remain unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant R as Report.php
participant FS as File System
participant INI as INI Parser
participant T as Timer/Sleep
rect rgb(235, 245, 255)
Note over R: For each plugin config (inner loop with limited retries)
R->>FS: Check file exists
alt File missing
R-->>R: Mark as missing (existing logic)
R->>T: sleep()
R-->>R: Next retry / break (existing logic)
else File exists
R->>FS: Stat file size
alt New guard (not required AND plugin AND size==0)
Note right of R: New behavior: continue without marking invalid
R-->>R: continue (retry loop proceeds)
else Non-empty or required
R->>INI: Parse INI
alt Parse ok
R-->>R: proceed as valid (existing logic)
else Parse fail
R-->>R: mark invalid (existing logic)
R->>T: sleep()
R-->>R: Next retry / break (existing logic)
end
end
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
emhttp/plugins/dynamix/include/Report.php (1)
24-26: Initialize$flagper file to avoid future undefined-variable pathsDefensive init clarifies intent and prevents undefined
$flagif newcontinuepaths are added later.[$name,$need,$plugin] = explode(':',$file); $filename = $plugin ? "$config/plugins/$name/$name.cfg" : "$config/$name.cfg"; + $flag = 0; for ( $i=0;$i<2;$i++) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
emhttp/plugins/dynamix/include/Report.php(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Squidly271
PR: unraid/webgui#0
File: :0-0
Timestamp: 2025-05-31T05:10:13.120Z
Learning: Squidly271 prefers not to receive CodeRabbit reviews or feedback while PRs are in draft status. Only provide reviews after PRs are moved out of draft.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit