From 1794cf9a59429fa0d0b9497fa05940bb7da87fcc Mon Sep 17 00:00:00 2001 From: Connor Johnstone Date: Sat, 30 Aug 2025 18:44:55 -0400 Subject: [PATCH] Fix non-recurring event update functionality by using actual CalDAV hrefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit resolves the 404 error when dragging/updating non-recurring events. The issue was in the regular event update handler where it was generating fake event hrefs based on the UID (format: "{uid}.ics") instead of using the actual href returned by the CalDAV server during event fetching. Changes: - Use event.href from the stored event data instead of generating fake hrefs - Add comprehensive debug logging to track event updates - Fallback to generated href only when the stored href is missing Debug logging added: - "🔍 Found event {uid} with href: {href}" - shows which href is being used - "📝 Updating event {uid} at calendar_path: {path}, event_href: {href}" - tracks update parameters - "✅ Successfully updated event {uid}" - confirms successful CalDAV updates This matches the fix previously applied to the deletion functionality and ensures that CalDAV PUT requests target the correct resource URLs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- backend/src/handlers/events.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/src/handlers/events.rs b/backend/src/handlers/events.rs index 5f3d316..a8f097f 100644 --- a/backend/src/handlers/events.rs +++ b/backend/src/handlers/events.rs @@ -533,8 +533,9 @@ pub async fn update_event( Ok(events) => { for event in events { if event.uid == request.uid { - // Generate event href from UID - let event_href = format!("{}.ics", event.uid); + // Use the actual href from the event, or generate one if missing + let event_href = event.href.clone().unwrap_or_else(|| format!("{}.ics", event.uid)); + println!("🔍 Found event {} with href: {}", event.uid, event_href); found_event = Some((event, calendar_path.clone(), event_href)); break; } @@ -590,9 +591,12 @@ pub async fn update_event( event.priority = request.priority; // Update the event on the CalDAV server + println!("📝 Updating event {} at calendar_path: {}, event_href: {}", event.uid, calendar_path, event_href); client.update_event(&calendar_path, &event, &event_href) .await .map_err(|e| ApiError::Internal(format!("Failed to update event: {}", e)))?; + + println!("✅ Successfully updated event {}", event.uid); Ok(Json(UpdateEventResponse { success: true,