Skip to content

iCal.js lenient mode - #93

Merged
Wetzel402 merged 1 commit into
devfrom
iCal_js-lenient_mode
Apr 2, 2026
Merged

iCal.js lenient mode #93
Wetzel402 merged 1 commit into
devfrom
iCal_js-lenient_mode

Conversation

@Wetzel402

@Wetzel402 Wetzel402 commented Apr 2, 2026

Copy link
Copy Markdown
Owner

fix: iCal.js lenient mode (see https://bugzilla.mozilla.org/show_bug.cgi?id=1754412)
chore: bump npm packages

Summary by CodeRabbit

  • Bug Fixes
    • Improved calendar import robustness by gracefully skipping malformed events instead of failing the entire import process.
    • Enhanced compatibility with various calendar formats and edge cases.

@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 90ec58ac-7467-440d-8141-63c15132bf3f

📥 Commits

Reviewing files that changed from the base of the PR and between e99d677 and ab8e0e9.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • app/plugins/02.appInit.ts
  • server/integrations/iCal/client.ts
  • test/unit/server/integrations/iCal/client.test.ts

📝 Walkthrough

Walkthrough

The PR enhances iCalendar parsing fault-tolerance by disabling strict mode globally, wrapping event parsing in try-catch blocks, and returning null for unparseable events. Invalid events are skipped with logged warnings instead of causing the entire import to fail.

Changes

Cohort / File(s) Summary
Global Configuration
app/plugins/02.appInit.ts
Set ical.design.strict = false to allow lenient parsing of non-standard iCalendar formats.
iCal Client Implementation
server/integrations/iCal/client.ts
Added error handling for event parsing: new parseICalEventOrNull wrapper method catches parse exceptions and returns null; wrapped VEVENT loop in try-catch to skip invalid events with warnings; updated recurring event expansion to use parseICalEventOrNull fallback; added getVeventUidForLog helper for informative logging.
Unit Tests
test/unit/server/integrations/iCal/client.test.ts
Added fixture with mixed valid and invalid VEVENTs; added tests verifying fetchEventsFromUrl preserves valid events while gracefully skipping malformed ones, with separate test confirming strict mode filtering behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • iCal bug fixes #73: Also modifies iCal event parsing in server/integrations/iCal/client.ts, specifically adjusting dtend computation within parseICalEvent, making it a code-level dependency concern with these fault-tolerance changes.

Poem

🐰 A stricter parser once stood guard,
But gentle lenience works harder!
We'll skip the broken, log with care,
And let the good events declare. 📅✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch iCal_js-lenient_mode

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.

@Wetzel402
Wetzel402 merged commit ae28d5b into dev Apr 2, 2026
1 of 2 checks passed
@Wetzel402
Wetzel402 deleted the iCal_js-lenient_mode branch April 2, 2026 17:25
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