Fix: set PRODID on collection upload

This commit is contained in:
Peter Bieringer 2024-12-15 08:28:37 +01:00
parent 4d04c85f2d
commit f1d007a51e

View file

@ -29,7 +29,7 @@ from typing import Iterator, List, Mapping, MutableMapping, Optional, Tuple
import vobject import vobject
import radicale.item as radicale_item import radicale.item as radicale_item
from radicale import httputils, pathutils, rights, storage, types, xmlutils from radicale import httputils, pathutils, rights, storage, types, xmlutils, utils
from radicale.app.base import Access, ApplicationBase from radicale.app.base import Access, ApplicationBase
from radicale.hook import HookNotificationItem, HookNotificationItemTypes from radicale.hook import HookNotificationItem, HookNotificationItemTypes
from radicale.log import logger from radicale.log import logger
@ -37,6 +37,8 @@ from radicale.log import logger
MIMETYPE_TAGS: Mapping[str, str] = {value: key for key, value in MIMETYPE_TAGS: Mapping[str, str] = {value: key for key, value in
xmlutils.MIMETYPES.items()} xmlutils.MIMETYPES.items()}
PRODID = u"-//Radicale//NONSGML Version " + utils.package_version("radicale") + "//EN"
def prepare(vobject_items: List[vobject.base.Component], path: str, def prepare(vobject_items: List[vobject.base.Component], path: str,
content_type: str, permission: bool, parent_permission: bool, content_type: str, permission: bool, parent_permission: bool,
@ -80,6 +82,7 @@ def prepare(vobject_items: List[vobject.base.Component], path: str,
vobject_collection = vobject.iCalendar() vobject_collection = vobject.iCalendar()
for component in components: for component in components:
vobject_collection.add(component) vobject_collection.add(component)
vobject_collection.add(vobject.base.ContentLine("PRODID", [], PRODID))
item = radicale_item.Item(collection_path=collection_path, item = radicale_item.Item(collection_path=collection_path,
vobject_item=vobject_collection) vobject_item=vobject_collection)
item.prepare() item.prepare()