Skip to content

fix(calendar): only offer calendars that support the attachment's components - #14015

Open
carlospintojunior wants to merge 1 commit into
nextcloud:mainfrom
carlospintojunior:fix/calendar-import-supported-components
Open

carlospintojunior wants to merge 1 commit into
nextcloud:mainfrom
carlospintojunior:fix/calendar-import-supported-components

Conversation

@carlospintojunior

Copy link
Copy Markdown

Summary

When importing an .ics attachment via Import into calendar, every writable calendar is offered — including task-only calendars such as the default Tasks calendar. getCalendarData() hard-coded components: { vevent: true } (there was a comment noting the missing check), so supported-calendar-component-set was requested in the PROPFIND but never evaluated.

Picking a VTODO-only calendar for an invitation that contains a VEVENT makes the server reject the PUT, and the user only sees the generic "Could not create event" toast, with no hint why.

Changes

  • DAVService.getSupportedComponents() reads supported-calendar-component-set (single comp or a list). A missing property is treated as "all components", per RFC 4791 §5.2.3.
  • getUserCalendars(requiredComponents = ['VEVENT']) only returns writable calendars that accept all requested components. Existing callers (EventModal, Itinerary) keep the VEVENT default, which is now actually enforced.
  • New getCalendarComponents(data) returns the component types (VEVENT / VJOURNAL / VTODO) contained in an iCalendar file.
  • MessageAttachment: downloads the attachment before listing calendars and only offers the ones that can store its contents. If none qualifies, a hint is shown instead of an empty list. Errors while loading calendars are now caught (previously the spinner could stay forever).
  • Unit tests for the new filtering and component detection.

How to reproduce (before)

  1. Have the default Personal (VEVENT) and Tasks (VTODO) calendars.
  2. Open a mail with a calendar invitation (invite.ics, VEVENT) attached.
  3. Import into calendar → both Personal and Tasks are listed.
  4. Choose Tasks → "Could not create event".

After: only Personal is listed.

Notes

A follow-up could surface the actual server error (e.g. the event already existing in the calendar after accepting the invitation, which currently also ends in the same generic toast). Kept out of this PR to keep it small.

Checklist

  • Unit tests added (src/tests/unit/service/DAVService.spec.js), fail without the fix
  • eslint clean on changed files
  • Commit signed off (DCO)

🤖 Generated with Claude Code

The supported component set of each calendar was hard-coded to VEVENT,
so "Import into calendar" also offered task-only calendars such as the
default "Tasks" calendar. Importing an invitation there always failed
with the generic "Could not create event" error.

Evaluate supported-calendar-component-set, treating a missing property
as "all components" as defined by RFC 4791 section 5.2.3, and only offer
calendars that accept every component type in the attachment.

Converting an event into a task on import is intentionally not done: it
would be a new feature, not a fix. Surfacing the actual reason of a
failed import is handled separately.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: carlos <carlos@vulcanum.com.br>
@carlospintojunior
carlospintojunior force-pushed the fix/calendar-import-supported-components branch from 9f6e91d to 6364487 Compare November 2, 2026 16:33

This branch has not been deployed

No deployments
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