Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc2822 committed Oct 22, 2024
1 parent 41443cc commit 236b11d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,19 @@ class CalendarSyncManager @AssistedInject constructor(
logger.info("Downloading ${bunch.size} iCalendars: $bunch")
SyncException.wrapWithRemoteResource(collection.url) {
davCollection.multiget(bunch) { response, _ ->
/*
* Real-world servers may return:
*
* - unrelated resources
* - the collection itself
* - the requested resources, but with a different collection URL (for instance, `/cal/1.ics` instead of `/shared-cal/1.ics`).
*
* So we:
*
* - ignore unsuccessful responses,
* - ignore responses without requested calendar data (should also ignore collections and hopefully unrelated resources), and
* - take the last segment of the href as the file name and assume that it's in the requested collection.
*/
SyncException.wrapWithRemoteResource(response.href) wrapResource@ {
if (!response.isSuccess()) {
logger.warning("Ignoring non-successful multi-get response for ${response.href}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ class ContactsSyncManager @AssistedInject constructor(
}
}
davCollection.multiget(bunch, contentType, version) { response, _ ->
// See CalendarSyncManager for more information about the multi-get response
SyncException.wrapWithRemoteResource(response.href) wrapResource@ {
if (!response.isSuccess()) {
logger.warning("Ignoring non-successful multi-get response for ${response.href}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class JtxSyncManager @AssistedInject constructor(
// multiple iCalendars, use calendar-multi-get
SyncException.wrapWithRemoteResource(collection.url) {
davCollection.multiget(bunch) { response, _ ->
// See CalendarSyncManager for more information about the multi-get response
SyncException.wrapWithRemoteResource(response.href) wrapResource@ {
if (!response.isSuccess()) {
logger.warning("Ignoring non-successful multi-get response for ${response.href}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class TasksSyncManager @AssistedInject constructor(
// multiple iCalendars, use calendar-multi-get
SyncException.wrapWithRemoteResource(collection.url) {
davCollection.multiget(bunch) { response, _ ->
// See CalendarSyncManager for more information about the multi-get response
SyncException.wrapWithRemoteResource(response.href) wrapResource@ {
if (!response.isSuccess()) {
logger.warning("Ignoring non-successful multi-get response for ${response.href}")
Expand Down

0 comments on commit 236b11d

Please sign in to comment.