nextcloud / nextcloud/android

Backup of Calendar - Exception while saving one calendar stops saving all following calendars

Open
#16,220 2 comments 0 reactions 0 assignees View on GitHub
0. Needs triage bug
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

1. Have multiple calendars
2. Activate Backups of Contatcs and Calendars
3. Wait till backups where created
4. Check backed up calendars

### Expected behaviour

All calendars should be backed up

### Actual behaviour

I have multiple calendars, but only two of them are being backed up

### Android version

16

### Device brand and model

Google Pixel 8

### Stock or custom OS?

Stock

### Nextcloud android app version

3.34.1

### Nextcloud server version

32.0.3

### Using a reverse proxy?

Yes

### Android logs

_No response_

### Server error logs

```bash

```

### Additional information

I digged into the logs and found a DateTimeExeption while saving an event.
Sorry, didn't save / overwrote the log while repairing that buggy event. :-(

This exception aborted the whole backup and only the two calendars before the coruppted one where saved.
The reason is the following loop, that doesn't handle possible exceptions from class SaveCalendar:

https://github.com/nextcloud/android/blob/7fd5807fa94d2f39a4eb6d71ebdc84b0156acbfd/app/src/main/java/com/nextcloud/client/jobs/CalendarBackupWork.kt#L51

Handling those excpetions could create an additional file "CalendarName-Timestamp-error.txt" with the message of that exception. So users can repair those buggy events.

Maybe, those exceptions should already be handled while saving those buggy events

https://github.com/nextcloud/android/blob/3161b78355c6c95fda5c27407acfd8a912d7e1c9/app/src/main/java/third_parties/sufficientlysecure/SaveCalendar.java#L179

So a backup file could be created for the calendar, that does not contain the buggy event(s), and the error file could list all events, that could not be saved. Because the events could be read before saving, the event details can be written to the error file, too.

Edit: After deleting that buggy event, all calendars get backed up again.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.