{"record":{"id":"603f683f48864094","repo":"siyuan-note/siyuan","slug":"caldav-calendar-object-path-is-invalid","errorCode":null,"errorMessage":"CalDAV: calendar object path is invalid","messagePattern":"CalDAV: calendar object path is invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/caldav.go","lineNumber":87,"sourceCode":"\t\tPath:                  CalDavDefaultCalendarPath,\n\t\tName:                  CalDavDefaultCalendarName,\n\t\tDescription:           \"Default calendar\",\n\t\tMaxResourceSize:       calendarMaxResourceSize,\n\t\tSupportedComponentSet: calendarSupportedComponentSet,\n\t}\n\tcalendars = Calendars{\n\t\tloaded:            false,\n\t\tchanged:           false,\n\t\tlock:              sync.Mutex{},\n\t\tcalendars:         sync.Map{},\n\t\tcalendarsMetaData: []*caldav.Calendar{},\n\t}\n\n\tErrorCalDavCalendarNotFound    = errors.New(\"CalDAV: calendar not found\")\n\tErrorCalDavCalendarPathInvalid = errors.New(\"CalDAV: calendar path is invalid\")\n\n\tErrorCalDavCalendarObjectNotFound    = errors.New(\"CalDAV: calendar object not found\")\n\tErrorCalDavCalendarObjectPathInvalid = errors.New(\"CalDAV: calendar object path is invalid\")\n)\n\n// CalendarsMetaDataFilePath returns the absolute path of the calendars' meta data file\nfunc CalendarsMetaDataFilePath() string {\n\treturn DavPath2DirectoryPath(CalDavCalendarsMetaDataFilePath)\n}\n\nfunc GetCalDavPathDepth(urlPath string) CalDavPathDepth {\n\turlPath = PathCleanWithSlash(urlPath)\n\treturn CalDavPathDepth(len(strings.Split(urlPath, \"/\")) - 1)\n}\n\n// GetCardDavPathDepth parses\nfunc ParseCalendarObjectPath(objectPath string) (calendarPath string, objectID string, err error) {\n\tcalendarPath, objectFileName := path.Split(objectPath)\n\tcalendarPath = PathCleanWithSlash(calendarPath)\n\tobjectID = path.Base(objectFileName)\n\tobjectFileExt := util.Ext(objectFileName)","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/caldav.go#L69-L105","documentation":"ErrorCalDavCalendarObjectPathInvalid is returned by ParseCalendarObjectPath when the object file extension is not the expected iCalendar extension (ICalendarFileExt, i.e. .ics). A valid calendar object path must end in an .ics file name.","triggerScenarios":"Calling ParseCalendarObjectPath with a path whose final segment lacks the .ics extension; issuing GET/PUT/DELETE against a non-iCalendar resource inside a calendar collection.","commonSituations":"Clients uploading raw JSON or text files into a calendar collection; broken URL generation appending the wrong suffix; confusion between calendar and calendar-object path shapes.","solutions":["Ensure the object path ends with a filename having the .ics extension","Use object URLs exactly as returned by ListCalendarObjects","Fix client URL templates that omit or alter the file extension"],"exampleFix":"// before\nParseCalendarObjectPath(\"/dav/caldav/calendars/mycal/event\")\n// after\nParseCalendarObjectPath(\"/dav/caldav/calendars/mycal/event.ics\")","handlingStrategy":"validation","validationCode":"if filepath.Ext(objectPath) != \".ics\" {\n    return fmt.Errorf(\"calendar object path must end in .ics: %q\", objectPath)\n}","typeGuard":null,"tryCatchPattern":"if errors.Is(err, ErrorCalDavCalendarObjectPathInvalid) {\n    // fix the URL template and return 400 to the client\n}","preventionTips":["Always append the .ics extension when generating calendar object URLs","Reuse object hrefs from ListCalendarObjects instead of templates","Keep calendar and calendar-object path builders separate"],"tags":["caldav","url","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}