aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-03-15 05:52:31 -0500
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-03-15 05:52:31 -0500
commitda42b4ddbc1856ab6e3a68ea0727e685020fee4e (patch)
tree34f6f6a7c1c1ea249b98ced336f1bd734965c873 /src
parenta0c0b2a91e698f569dcce1c6f08d67399004c537 (diff)
Fix game domain override for all Nexus API request types (site mods)
The previous fix only overrode m_GameName in requestFileInfo and requestDownloadURL, but after the download completes STATE_FETCHINGMODINFO triggers requestDescription with the same fallback game plugin issue, causing 404s for nexusmods.com/site mods. Consolidate into applyGameNameOverride() helper called from: - requestFileInfo - requestDownloadURL - requestDescription - requestModInfo This ensures all API calls use "site" as the game domain when no matching game plugin is found. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src')
-rw-r--r--src/src/nexusinterface.cpp27
-rw-r--r--src/src/nexusinterface.h5
2 files changed, 21 insertions, 11 deletions
diff --git a/src/src/nexusinterface.cpp b/src/src/nexusinterface.cpp
index ff0a58c..9de1b45 100644
--- a/src/src/nexusinterface.cpp
+++ b/src/src/nexusinterface.cpp
@@ -470,6 +470,7 @@ int NexusInterface::requestDescription(QString gameName, int modID, QObject* rec
{
NXMRequestInfo requestInfo(modID, NXMRequestInfo::TYPE_DESCRIPTION, userData,
subModule, game);
+ applyGameNameOverride(requestInfo, gameName, game);
m_RequestQueue.enqueue(requestInfo);
connect(this, SIGNAL(nxmDescriptionAvailable(QString, int, QVariant, QVariant, int)),
@@ -497,6 +498,7 @@ int NexusInterface::requestModInfo(QString gameName, int modID, QObject* receive
NXMRequestInfo requestInfo(modID, NXMRequestInfo::TYPE_MODINFO, userData, subModule,
game);
+ applyGameNameOverride(requestInfo, gameName, game);
m_RequestQueue.enqueue(requestInfo);
connect(this, SIGNAL(nxmModInfoAvailable(QString, int, QVariant, QVariant, int)),
@@ -625,12 +627,7 @@ int NexusInterface::requestFileInfo(QString gameName, int modID, int fileID,
NXMRequestInfo requestInfo(modID, fileID, NXMRequestInfo::TYPE_FILEINFO, userData,
subModule, gamePlugin);
- // If the game plugin was a fallback (managed game), the NXM game name may be a
- // different domain (e.g. "site" for Nexus tools). Override so the API URL is correct.
- if (gamePlugin->gameShortName().compare(gameName, Qt::CaseInsensitive) != 0 &&
- gamePlugin->gameNexusName().compare(gameName, Qt::CaseInsensitive) != 0) {
- requestInfo.m_GameName = gameName.toLower();
- }
+ applyGameNameOverride(requestInfo, gameName, gamePlugin);
m_RequestQueue.enqueue(requestInfo);
connect(
@@ -654,11 +651,7 @@ int NexusInterface::requestDownloadURL(QString gameName, int modID, int fileID,
{
NXMRequestInfo requestInfo(modID, fileID, NXMRequestInfo::TYPE_DOWNLOADURL, userData,
subModule, game);
- // Override game name if the plugin was a fallback (e.g. "site" has no game plugin)
- if (game && game->gameShortName().compare(gameName, Qt::CaseInsensitive) != 0 &&
- game->gameNexusName().compare(gameName, Qt::CaseInsensitive) != 0) {
- requestInfo.m_GameName = gameName.toLower();
- }
+ applyGameNameOverride(requestInfo, gameName, game);
m_RequestQueue.enqueue(requestInfo);
connect(this,
@@ -1238,6 +1231,18 @@ APIStats NexusInterface::getAPIStats() const
return stats;
}
+void NexusInterface::applyGameNameOverride(NXMRequestInfo& info, const QString& gameName,
+ const MOBase::IPluginGame* game) const
+{
+ // When gameName has no matching plugin (e.g. "site" for Nexus tools), getGame()
+ // returns the managed game as a fallback, causing NXMRequestInfo to store the wrong
+ // game name (e.g. "skyrimspecialedition" instead of "site"). Override it here.
+ if (game && game->gameShortName().compare(gameName, Qt::CaseInsensitive) != 0 &&
+ game->gameNexusName().compare(gameName, Qt::CaseInsensitive) != 0) {
+ info.m_GameName = gameName.toLower();
+ }
+}
+
namespace
{
QString get_management_url()
diff --git a/src/src/nexusinterface.h b/src/src/nexusinterface.h
index eaae29f..cf11804 100644
--- a/src/src/nexusinterface.h
+++ b/src/src/nexusinterface.h
@@ -675,6 +675,11 @@ private:
void requestFinished(std::list<NXMRequestInfo>::iterator iter);
MOBase::IPluginGame* getGame(QString gameName) const;
QString getOldModsURL(QString gameName) const;
+ // When the game name has no matching plugin (e.g. "site"), getGame() returns the
+ // managed game as a fallback but sets the wrong m_GameName in the request. This
+ // overrides it back to the raw requested name so API URLs use the correct domain.
+ void applyGameNameOverride(NXMRequestInfo& info, const QString& gameName,
+ const MOBase::IPluginGame* game) const;
private:
QNetworkDiskCache* m_DiskCache;