Skip to content

Calendar activity links break ("Event does not exist") when the uid contains a space — owner/affectedUser not URL-encoded in CalDAV Activity Event provider #61738

Description

@4emeligne

Bug description

When a user whose uid contains a space (e.g. Elisa Ciria) creates a calendar event, the entry appears in the Activity stream ("X created event Y"). Clicking the event opens the Calendar app, which shows "Event does not exist" — even though the event exists and is perfectly usable inside the Calendar app itself.

Root cause

In apps/dav/lib/CalDAV/Activity/Provider/Event.php, generateObjectParameter() builds the event deep-link by base64-encoding a CalDAV path. Only calendar_uri is URL-encoded (urlencodeLowerHex()); the principal segment is inserted raw:

// owner branch
$objectId = base64_encode($this->url->getWebroot() . '/remote.php/dav/calendars/'
    . $linkData['owner'] . '/' . $calendarUri . '/' . $linkData['object_uri']);

// shared branch
$objectId = base64_encode($this->url->getWebroot() . '/remote.php/dav/calendars/'
    . $affectedUser . '/' . $calendarUri . '_shared_by_' . $linkData['owner'] . '/' . $linkData['object_uri']);

If the uid contains a space, the decoded path is /remote.php/dav/calendars/Elisa Ciria/... (literal space) instead of /remote.php/dav/calendars/Elisa%20Ciria/.... The Calendar app cannot match this against the actual (percent-encoded) CalDAV object href → "Event does not exist".

Steps to reproduce

  1. Create a user with a space in the uid (e.g. Elisa Ciria).
  2. As that user, create a calendar event.
  3. Open Activity, click the event.
  4. → Calendar opens on "Event does not exist".

Expected behaviour

The link opens the event.

Actual behaviour

"Event does not exist" (while the event exists and opens fine from within Calendar).

Affected versions

Reproduced on Nextcloud 31.0.6 (dav app 1.33.0). The unencoded insertion is still present on master and stable31 (verified on GitHub). Related: #17610, nextcloud/calendar#2199, #43430. PR #45775 fixed only the shared-calendar notification link, not the owner/affectedUser encoding.

Proposed fix

Wrap the principal segments in rawurlencode() (space → %20):

// owner branch
... '/remote.php/dav/calendars/' . rawurlencode($linkData['owner']) . '/' . $calendarUri . '/' . $linkData['object_uri']

// shared branch
... '/remote.php/dav/calendars/' . rawurlencode($affectedUser) . '/' . $calendarUri . '_shared_by_' . rawurlencode($linkData['owner']) . '/' . $linkData['object_uri']

Since the link is generated on render (the oc_activity.link column stays empty), this fixes both existing and future activity entries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions