feature (dav): support for servers who have the username in their URL - #418

In the URL parameters for DAV backends (WebDAV and CalDAV/CardDAV) the
%{username} string is interpolated to the URL encoded username. It
shouldn't conflict with legitimate URLS as %{ is not a valid URL escape
sequence.

This is needed for some servers where the URL contains the username
such as Cyrus IMAP.
This commit is contained in:
Mildred Ki'Lya 2022-01-14 12:51:53 +01:00 committed by GitHub
parent a91df1637d
commit cf827673c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -41,7 +41,7 @@ func (this Dav) Init(params map[string]string, app *App) (IBackend, error) {
return backend, nil
}
backend := Dav{
url: params["url"],
url: strings.ReplaceAll(params["url"], "%{username}", url.PathEscape(params["username"])),
which: params["type"],
params: params,
}

View file

@ -35,7 +35,7 @@ func (w WebDav) Init(params map[string]string, app *App) (IBackend, error) {
}
backend := WebDav{
params: &WebDavParams{
params["url"],
strings.ReplaceAll(params["url"], "%{username}", url.PathEscape(params["username"])),
params["username"],
params["password"],
params["path"],