diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index 0816e926..adb3d6fa 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -114,10 +114,11 @@ void Download::executeTask() } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); + // TODO remove duplication and use constant if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host().contains("api.curseforge.com")) { + && request.url().host() == "api.curseforge.com") { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host().contains("api.modrinth.com")) { + } else if (request.url().host() == "api.modrinth.com") { QString token = APPLICATION->getModrinthAPIToken(); if (!token.isNull()) request.setRawHeader("Authorization", token.toUtf8()); diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp index 36d50c1e..cd0de945 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -217,10 +217,11 @@ namespace Net { } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); + // TODO remove duplication and use constant if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host().contains("api.curseforge.com")) { + && request.url().host() == "api.curseforge.com") { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host().contains("api.modrinth.com")) { + } else if (request.url().host() == "api.modrinth.com") { QString token = APPLICATION->getModrinthAPIToken(); if (!token.isNull()) request.setRawHeader("Authorization", token.toUtf8());