Skip to content

fix: tolerate empty BYMONTHDAY values - #3303

Open
sean0407 wants to merge 1 commit into
nextcloud:mainfrom
sean0407:codex/fix-invalid-bymonthday-list
Open

sean0407 wants to merge 1 commit into
nextcloud:mainfrom
sean0407:codex/fix-invalid-bymonthday-list

Conversation

@sean0407

Copy link
Copy Markdown

Summary

  • Remove empty values from BYMONTHDAY before parsing a task recurrence rule, so an invalid value such as ,24 does not make the task calendar disappear.
  • Add a regression test for the reported recurrence rule.

Fixes #3265

Checks

  • npm test -- tests/javascript/unit/models/task.spec.js (80 passed)
  • npx eslint src/models/task.js tests/javascript/unit/models/task.spec.js (passed)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T07:57:51.418290Z c156f6f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e9350b237

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/models/task.js
* @return {string}
*/
function normalizeEmptyByMonthDayValues(vcalendar) {
return vcalendar.replace(/(RRULE(?:;[^:\r\n]*)?:)([^\r\n]*)/gi, (line, prefix, rule) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Normalize folded RRULE content lines

When a CalDAV payload uses standard line folding before or within BYMONTHDAY (for example, RRULE:FREQ=MONTHLY;\r\n BYMONTHDAY=,24), this pattern stops at the physical CR/LF and never examines the continuation. ICAL.parse then unfolds the unchanged malformed value and rejects it, so the task/calendar disappearance this change is meant to prevent remains for folded recurrence rules; unfold the content line or include its continuations before sanitizing.

Useful? React with 👍 / 👎.

Comment thread src/models/task.js
* @return {string}
*/
function normalizeEmptyByMonthDayValues(vcalendar) {
return vcalendar.replace(/(RRULE(?:;[^:\r\n]*)?:)([^\r\n]*)/gi, (line, prefix, rule) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Anchor normalization to RRULE property lines

Whenever another property contains the substring RRULE:—for example the valid URI URL:https://example.test/inspect?RRULE:FREQ=MONTHLY;BYMONTHDAY=,24—this unanchored regexp treats the rest of that property as a recurrence rule and removes the comma from its value. The constructor stores the changed value in jCal, which updateTask later serializes via ICAL.stringify(task.jCal) in src/store/tasks.js:1114, silently corrupting URL or extension data on the next edit; restrict matching to an RRULE property name at the start of an unfolded content line.

Useful? React with 👍 / 👎.

Signed-off-by: Sean <sean0407@users.noreply.github.com>
@sean0407
sean0407 force-pushed the codex/fix-invalid-bymonthday-list branch from 5e9350b to c156f6f Compare October 21, 2026 07:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c156f6f52b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/models/task.js
return vcalendar.replace(/(RRULE(?:;[^:\r\n]*)?:)([^\r\n]*)/gi, (line, prefix, rule) => {
return prefix + rule.replace(/(^|;)BYMONTHDAY=([^;]*)/i, (part, separator, days) => {
const normalizedDays = days.split(',').filter(Boolean).join(',')
return normalizedDays ? `${separator}BYMONTHDAY=${normalizedDays}` : ''

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drop the following delimiter with a leading empty part

When BYMONTHDAY is the first rule part and every entry is empty, for example RRULE:BYMONTHDAY=,;FREQ=MONTHLY, separator is empty and this branch emits RRULE:;FREQ=MONTHLY. Recurrence parts may legally precede FREQ, but the resulting leading empty part is invalid and ical.js rejects it, so these tasks still fail to load instead of being normalized; when dropping the first part, consume the following semicolon as well.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid monthly recurrence rule causes entire task list to disappear

1 participant