fix: replace unguarded crypto.randomUUID() with safe generateUUID() utility

This commit is contained in:
Linus Rath
2026-04-02 14:51:21 +02:00
parent 1bdc51dcc7
commit c4673acb65
14 changed files with 38 additions and 25 deletions
+2 -3
View File
@@ -6,6 +6,7 @@ import { debug } from '@/lib/debug';
import { normalizeAllDayDuration } from '@/lib/calendar-utils';
import { sanitizeOutgoingCalendarEventData } from '@/lib/calendar-event-normalization';
import { expandRecurringEvents } from '@/lib/recurrence-expansion';
import { generateUUID } from '@/lib/utils';
export type CalendarViewMode = 'month' | 'week' | 'day' | 'agenda' | 'tasks';
@@ -722,9 +723,7 @@ export const useCalendarStore = create<CalendarStore>()(
if (!calendar) throw new Error('Failed to create calendar');
const subscription: ICalSubscription = {
id: typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
? crypto.randomUUID()
: `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`,
id: generateUUID(),
url,
calendarId: calendar.id,
name,