Changeset View
Changeset View
Standalone View
Standalone View
src/common/davitemsfetchjob.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | 96 | while (!responseElement.isNull()) { | |||
---|---|---|---|---|---|
111 | const QDomElement propElement = Utils::firstChildElementNS(propstatElement, QStringLiteral("DAV:"), QStringLiteral("prop")); | 111 | const QDomElement propElement = Utils::firstChildElementNS(propstatElement, QStringLiteral("DAV:"), QStringLiteral("prop")); | ||
112 | 112 | | |||
113 | DavItem item; | 113 | DavItem item; | ||
114 | 114 | | |||
115 | // extract path | 115 | // extract path | ||
116 | const QDomElement hrefElement = Utils::firstChildElementNS(responseElement, QStringLiteral("DAV:"), QStringLiteral("href")); | 116 | const QDomElement hrefElement = Utils::firstChildElementNS(responseElement, QStringLiteral("DAV:"), QStringLiteral("href")); | ||
117 | const QString href = hrefElement.text(); | 117 | const QString href = hrefElement.text(); | ||
118 | 118 | | |||
119 | QUrl url = davJob->url(); | 119 | QUrl url = QUrl::fromUserInput(href); | ||
120 | if (href.startsWith(QLatin1Char('/'))) { | 120 | if (href.startsWith(QLatin1Char('/'))) { | ||
121 | // href is only a path, use request url to complete | 121 | // href is a relative URL (i.e. missing scheme, hostname and so on) | ||
122 | url.setPath(href, QUrl::TolerantMode); | 122 | // QUrl would treat this as a file URL be default, avoid that by setting | ||
123 | } else { | 123 | // empty scheme. | ||
124 | // href is a complete url | 124 | // Note: We don't want to expand this into a full URL (including hostname) | ||
125 | url = QUrl::fromUserInput(href); | 125 | // as some CalDav implementations don't seem to handle that correctly. | ||
126 | url.setScheme(QString()); | ||||
126 | } | 127 | } | ||
127 | 128 | | |||
128 | auto _url = url; | 129 | auto _url = url; | ||
129 | _url.setUserInfo(mCollectionUrl.url().userInfo()); | 130 | _url.setUserInfo(mCollectionUrl.url().userInfo()); | ||
130 | item.setUrl(DavUrl(_url, mCollectionUrl.protocol())); | 131 | item.setUrl(DavUrl(_url, mCollectionUrl.protocol())); | ||
131 | 132 | | |||
132 | // extract etag | 133 | // extract etag | ||
133 | const QDomElement getetagElement = Utils::firstChildElementNS(propElement, QStringLiteral("DAV:"), QStringLiteral("getetag")); | 134 | const QDomElement getetagElement = Utils::firstChildElementNS(propElement, QStringLiteral("DAV:"), QStringLiteral("getetag")); | ||
Show All 26 Lines |