Skip to content

Commit

Permalink
[buteo-sync-plugin-carddav] Support minimal server URLs. Contributes …
Browse files Browse the repository at this point in the history
…to JB#43847

Previously, if the server URL was specified by the client like:
  carddav.server.tld
instead of:
  https://carddav.server.tld/
we would not correctly populate it with the required scheme and
path information.

This commit ensures that we do so in that case.

Contributes to JB#43847
  • Loading branch information
Chris Adams committed Apr 2, 2019
1 parent 2fd6390 commit e30631b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/carddav.cpp
Expand Up @@ -506,6 +506,11 @@ void CardDav::fetchUserInformation()
*/

QUrl serverUrl(m_serverUrl);
if (serverUrl.scheme().isEmpty() && (serverUrl.host().isEmpty() || serverUrl.path().isEmpty())) {
// assume the supplied server url is like: "carddav.server.tld"
m_serverUrl = QStringLiteral("https://%1/").arg(m_serverUrl);
serverUrl = QUrl(m_serverUrl);
}
QString wellKnownUrl = QStringLiteral("%1://%2/.well-known/carddav").arg(serverUrl.scheme()).arg(serverUrl.host());
bool firstRequest = m_discoveryStage == CardDav::DiscoveryStarted;
m_serverUrl = firstRequest && (serverUrl.path().isEmpty() || serverUrl.path() == QStringLiteral("/"))
Expand Down

0 comments on commit e30631b

Please sign in to comment.