Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 663dbe9c authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Fix 401 on openId PUT sync requests

on SyncManager for openId accounts, accessToken was not passed for the
PUT requests, so CALDAV & CARDAV create/update requests for those
accounts were not pushed to the cloud.
parent 28a437c2
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -437,7 +437,7 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
                newFileName = local.prepareForUpload()

                val uploadUrl = collectionURL.newBuilder().addPathSegment(newFileName).build()
                remoteExceptionContext(DavResource(httpClient.okHttpClient, uploadUrl)) { remote ->
                remoteExceptionContext(DavResource(httpClient.okHttpClient, uploadUrl, accountSettings.credentials().authState?.accessToken)) { remote ->
                    Logger.log.info("Uploading new record ${local.id} -> $newFileName")
                    remote.put(generateUpload(local), ifNoneMatch = true, callback = readTagsFromResponse)
                }
@@ -446,7 +446,7 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
                local.prepareForUpload()

                val uploadUrl = collectionURL.newBuilder().addPathSegment(existingFileName).build()
                remoteExceptionContext(DavResource(httpClient.okHttpClient, uploadUrl)) { remote ->
                remoteExceptionContext(DavResource(httpClient.okHttpClient, uploadUrl, accountSettings.credentials().authState?.accessToken)) { remote ->
                    val lastScheduleTag = local.scheduleTag
                    val lastETag = if (lastScheduleTag == null) local.eTag else null
                    Logger.log.info("Uploading modified record ${local.id} -> $existingFileName (ETag=$lastETag, Schedule-Tag=$lastScheduleTag)")