nextcloud / nextcloud/contacts

Contacts web app unusable, possible after adding a contact with a not expected date field — TypeError: can't access property "getAllSubcomponents", this.component is null in sortContacts

Open
#5,250 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug feature: contacts
Dominant language
JavaScript
Stars
642
Forks
220
Avg merge
14h 39m
Merged PRs (30d)
51

Description

Describe the bug

The Contacts web app crashes somewhat and shows no address books when any contact contains a date field (BDAY, ANNIVERSARY, or custom fields like X-ABDATE) in the compact YYYYMMDD format. The compact format is valid per RFC 6350 (vCard 4.0), but ical.js throws an uncaught exception while trying to sort contacts, leaving the Vuex store in a broken state where no address books are displayed. The crash includes in the options menu, so that I am not able to even delete adressbooks. Funny Thing: the Contact groups on the left side are still beeing loaded, even with the correct number of contacts.

The error occurs in sortContactsgetContactsFromAddressBook and is completely unhandled, making the entire Contacts app unusable.

Context

  • The compact YYYYMMDD format is written by clients like Thunderbird CardBook and DAVx5 — both following the vCard 4.0 RFC. This is not a client bug.
  • The fix should be either in ical.js (support both date formats) or in contacts.js sortContacts (wrap in try/catch and skip invalid dates).

Nextcloud Server version: 33.0.2.2

Client: Firefox 149, Windows 10

DAV clients affected: Thunderbird CardBook, DAVx5

Steps to reproduce
  1. I assume the issue is triggered by a contact with a date field in compact format, e.g.:
BDAY:19800101

or a custom label date field created by DAVx5:

item1.X-ABLABEL:Todestag
item1.X-ABDATE:20230911
  1. Open the Contacts web app
Expected behavior

Either the date is parsed correctly (both YYYYMMDD and YYYY-MM-DD are valid per RFC 6350), or the error is caught gracefully and the affected contact is skipped — without breaking the entire address book view.

  • In the selected screenhots there should be two adressbooks
Actual behavior

The app crashes with:

TypeError: can't access property "getAllSubcomponents", this.component is null
    _ensureCoverage ical.js:3145
    utcOffset ical.js:3041
    utcOffset ical.js:1933
    utcOffset ical.js:4028
    toUnixTime ical.js:2136
    _4 contacts.js:31
    sortContacts contacts.js:221
    getContactsFromAddressBook addressbooks.js:415

No address books are displayed. (see screenshot) DAV sync clients continue to work normally.

Contact version

8.4.3

Operating system

ubuntu

PHP engine version

PHP 8.4

Web server

Apache (supported)

Database

MySQL

Additional info
Image Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with sortContacts in contacts.js and the getContactsFromAddressBook call in addressbooks.js, following the stack trace into the date handling in ical.js. Reproduce with a contact containing BDAY:19800101 or X-ABDATE:20230911, then verify that the Contacts app keeps its address books usable when compact dates are encountered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.