aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jobs')
-rw-r--r--lib/jobs/basejob.cpp7
-rw-r--r--lib/jobs/basejob.h6
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp
index 7cddc343..8e1a63aa 100644
--- a/lib/jobs/basejob.cpp
+++ b/lib/jobs/basejob.cpp
@@ -212,8 +212,11 @@ QUrl BaseJob::makeRequestUrl(QUrl baseUrl, const QString& path,
const QUrlQuery& query)
{
auto pathBase = baseUrl.path();
- if (!pathBase.endsWith('/') && !path.startsWith('/'))
- pathBase.push_back('/');
+ // QUrl::adjusted(QUrl::StripTrailingSlashes) doesn't help with root '/'
+ while (pathBase.endsWith('/'))
+ pathBase.chop(1);
+ if (!path.startsWith('/')) // Normally API files do start with '/'
+ pathBase.push_back('/'); // so this shouldn't be needed these days
baseUrl.setPath(pathBase + path, QUrl::TolerantMode);
baseUrl.setQuery(query);
diff --git a/lib/jobs/basejob.h b/lib/jobs/basejob.h
index c8046e9e..2049f59c 100644
--- a/lib/jobs/basejob.h
+++ b/lib/jobs/basejob.h
@@ -308,9 +308,9 @@ protected:
void setExpectedContentTypes(const QByteArrayList& contentTypes);
/** Construct a URL out of baseUrl, path and query
- * The function automatically adds '/' between baseUrl's path and
- * \p path if necessary. The query component of \p baseUrl
- * is ignored.
+ *
+ * The function ensures exactly one '/' between the path component of
+ * \p baseUrl and \p path. The query component of \p baseUrl is ignored.
*/
static QUrl makeRequestUrl(QUrl baseUrl, const QString& path,
const QUrlQuery& query = {});