v1.0.73: auto-upgrade http:// to https:// for WebDAV
Zahra's sync pair was configured with http://dav.khodak.me. Traefik has a global HTTP->HTTPS redirect, but PROPFIND/PUT/MOVE are not followed through redirects by OkHttp — so every WebDAV operation was getting redirected and silently failing. 1072 logins, 0 actual DAV operations. Silently rewrite http:// to https:// at the provider level so users never need to reconfigure.
This commit is contained in:
@@ -27,7 +27,14 @@ import java.util.concurrent.TimeUnit
|
||||
open class WebDavProvider(protected val account: CloudAccount) : CloudProvider {
|
||||
|
||||
protected open val baseUrl: String
|
||||
get() = account.serverUrl?.trimEnd('/') ?: ""
|
||||
get() {
|
||||
val raw = account.serverUrl?.trimEnd('/') ?: ""
|
||||
// Silently upgrade http:// → https:// so that phone configs saved with
|
||||
// http:// still work when the server only accepts HTTPS (e.g. behind Traefik
|
||||
// with a global HTTP→HTTPS redirect). WebDAV methods (PROPFIND, MKCOL, MOVE)
|
||||
// are not followed through redirects by OkHttp, so they would silently fail.
|
||||
return if (raw.startsWith("http://")) "https://" + raw.removePrefix("http://") else raw
|
||||
}
|
||||
|
||||
protected val client: OkHttpClient by lazy {
|
||||
val creds = Json.parseToJsonElement(account.credentialJson).jsonObject
|
||||
|
||||
Reference in New Issue
Block a user