Axivion: Fix url construction

We need to encode the project name as it could
contain symbols which let further modification
of the url fail in unexpected ways.

Fixes: QTCREATORBUG-32091
Change-Id: Ic9109aef5b5e64aea48f7dc2068003ca7f54a048
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2024-12-03 06:15:17 +01:00
parent 6d7e6fe267
commit f74b3d7673

View File

@@ -361,7 +361,9 @@ static QUrl constructUrl(const QString &projectName, const QString &subPath, con
{ {
if (!dd->m_dashboardInfo) if (!dd->m_dashboardInfo)
return {}; return {};
QUrl url = dd->m_dashboardInfo->source.resolved(QString("api/projects/" + projectName + '/')); const QByteArray encodedProjectName = QUrl::toPercentEncoding(projectName);
const QUrl path(QString{"api/projects/" + QString::fromUtf8(encodedProjectName) + '/'});
QUrl url = dd->m_dashboardInfo->source.resolved(path);
if (!subPath.isEmpty() && QTC_GUARD(!subPath.startsWith('/'))) if (!subPath.isEmpty() && QTC_GUARD(!subPath.startsWith('/')))
url = url.resolved(subPath); url = url.resolved(subPath);
if (!query.isEmpty()) if (!query.isEmpty())