[cozy-lib] Fix: handling resources=nil - #1607
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughChanged resource merging in Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Template as _resources.tpl
participant Merge as Merge Logic
Caller->>Template: invoke resource processing
alt resources present
Template->>Merge: deepCopy(resources)
Merge->>Merge: mergeOverwrite(presetMap)
Merge-->>Template: mergedMap (from resources+presets)
else resources absent
Template->>Merge: deepCopy({})
Merge->>Merge: mergeOverwrite(presetMap)
Merge-->>Template: mergedMap (from presets only)
end
Template-->>Caller: sanitized resources
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
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 |
Summary of ChangesHello Andrei Kvapil (@kvaps), I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a specific bug within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request effectively addresses the issue of handling nil resources in the cozy-lib.resources.defaultingSanitize template. By explicitly checking if $resources is nil before attempting to deepCopy and mergeOverwrite, the change prevents potential errors and ensures that the $presetMap is correctly used as the base when no specific resources are provided. This is a good and necessary fix for robustness.
Signed-off-by: Andrei Kvapil <kvapss@gmail.com> Co-authored-by: Timofei Larkin <lllamnyp@gmail.com>
f2a17cb to
00328c8
Compare
|
Successfully created backport PR for |
# Description Backport of #1607 to `release-0.37`.
Signed-off-by: Andrei Kvapil kvapss@gmail.com
What this PR does
Fixes issue:
Release note
Summary by CodeRabbit