Skip to content

Commit

Permalink
Ignore 403 ContentOperationNotPermitted errors due to shared calendars
Browse files Browse the repository at this point in the history
Some changes (e.g. changing the organizer of an event in a shared
calendar) are not allowed, even if the user has Owner access to the
shared calendar (since the organizer field is managed specially
by Google in the shared-calendar case, allowing only the organizer
or the creator of the event to write changes there).

If we hit such a failure, ignore it and allow sync to succeed.
  • Loading branch information
Chris Adams committed Jan 29, 2020
1 parent b8563fb commit 6940f22
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/google/google-calendars/googlecalendarsyncadaptor.cpp
Expand Up @@ -2122,7 +2122,17 @@ void GoogleCalendarSyncAdaptor::upsyncFinishedHandler()
// error occurred during request.
SOCIALD_LOG_ERROR("error" << httpCode << "occurred while upsyncing calendar data to Google account" << accountId << "; got:");
errorDumpStr(QString::fromUtf8(replyData));

// If we get a ContentOperationNotPermittedError, then allow the sync cycle to succeed.
// Most likely, it's an attempt to modify a shared event, and Google prevents
// any user other than the original creator of the event from modifying those.
// Such errors should not prevent the rest of the sync cycle from succeeding.
// TODO: is there some way to detect whether I am the organizer/owner of the event?
if (reply->error() == QNetworkReply::ContentOperationNotPermittedError) {
SOCIALD_LOG_TRACE("Ignoring 403 due to shared calendar resource");
} else {
m_syncSucceeded[accountId] = false;
}
} else if (upsyncType == GoogleCalendarSyncAdaptor::Delete) {
// we expect an empty response body on success for Delete operations
if (!replyData.isEmpty()) {
Expand Down

0 comments on commit 6940f22

Please sign in to comment.