Skip to content

Public calendars can be added multiple times #8134

@odzhychko

Description

@odzhychko

Steps to reproduce

  • As admin, configure at least one public calendar for users to subscribe to
    • e.g. php occ config:app:set calendar publicCalendars --value '[{"name":"de-holidays","source":"https://www.feiertage-deutschland.de/kalender-download/ical/feiertage-deutschland.ics"}]'
  • As user click "Add custom public calendar"
    Image
  • Subscribe to a public calendar e.g. de-holidays
  • Open "Add custom public calendar` again

Expected behavior

The subscribed calendar cannot be subscribed again.

Actual behavior

The calendar can be subscribed again:

Image

Calendar app version

6.2.2

CalDAV-clients used

No response

Browser

No response

Client operating system

No response

Server operating system

No response

Web server

None

Database engine version

None

PHP engine version

None

Nextcloud version

32.0.6.1

Updated from an older installed version or fresh install

fresh

List of activated apps


Nextcloud configuration


Web server error log


Log file


Browser log


Additional info

The issues seems to be, that X-NC-CalDAV-Webcal-Caching is not set correctly:

  • Code tries to set header X-NC-CalDAV-Webcal-Caching to Off when using a DavClient.

    export async function findAllSubscriptions() {
    const headers = {
    'X-NC-CalDAV-Webcal-Caching': 'Off',
    }
    // Ensure the client is initialized once
    await getClient(headers).connect({ enableCalDAV: true })
    return getCalendarHome(headers).findAllSubscriptions()
    }

  • But headers in getClient is only used as a cache key and never used when creating the client, so X-NC-CalDAV-Webcal-Caching is always On.

    function getClient(headers = {}) {
    const clientKey = getClientKey(headers)
    if (clients[clientKey]) {
    return clients[clientKey]
    }
    clients[clientKey] = new DavClient({
    rootUrl: generateRemoteUrl('dav'),
    defaultHeaders: {
    'X-NC-CalDAV-Webcal-Caching': 'On',
    },
    })
    return clients[clientKey]
    }

Seems to have accidentally broken in a refactoring/dependency upgrade: 8d13b4c

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions