Skip to content

Commit

Permalink
Add trailing slash to calendarList API call for confused proxies.
Browse files Browse the repository at this point in the history
  • Loading branch information
phw198 committed Dec 8, 2023
1 parent f503ccd commit 9a3bcc0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,18 @@ public void GetSettings() {
private void getCalendarSettings() {
SettingsStore.Calendar profile = Settings.Profile.InPlay();
CalendarListResource.GetRequest request = Service.CalendarList.Get(profile.UseGoogleCalendar.Id);
CalendarListEntry cal = request.Execute();
CalendarListEntry cal;
try {
cal = request.Execute();
} catch (Google.GoogleApiException ex) {
if (ex.InnerException is Newtonsoft.Json.JsonReaderException && ex.Message.StartsWith("<") && Settings.Instance.Proxy.Type != "None") {
log.Warn("Call to CalendarList API endpoint failed. Retrying with trailing '/' in case of poorly configured proxy.");
//The URI ends with "@group.calendar.google.com", which seemingly can cause confusion - see issue #1745
System.Net.Http.HttpRequestMessage hrm = request.CreateRequest();
hrm.RequestUri = new System.Uri(hrm.RequestUri + "/");
cal = request.Execute();
} else throw;
}
log.Info("Google calendar timezone: " + cal.TimeZone);

if (!profile.AddReminders) return;
Expand Down

0 comments on commit 9a3bcc0

Please sign in to comment.