caldav: fix applyFetch treating failed fetch as success
d29e081829c61e9b94f9073a59cc580f864ca512
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: ad75db34cdb2
Adversarial review caught it: fetchScript prints @@CAL headers before curl runs, so on an HTTP-level failure (e.g. 401 returns an error body, curl exits 0, nothing on stderr) stdout is non-empty but carries zero calendar-data blocks. The old guard 'if (!t.trim())' was false, so the code fell through to status=ok stale=false with an empty event list — a failed refresh masquerading as success. Guard on the 207 <d:multistatus> wrapper instead: present on any successful REPORT (including an empty month, so no false stale), absent on auth/transport failure. Verified live: real fetch still status=ok, 155 events, stale=false. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>