From 4706f894e315260be2a67b63127da6273d764354 Mon Sep 17 00:00:00 2001 From: 0x189D7997 <199489335+0x189D7997@users.noreply.github.com> Date: Sat, 4 Apr 2026 07:29:19 +0000 Subject: [PATCH] Activate search by project id only for numarical values for CurseForge Signed-off-by: 0x189D7997 <199489335+0x189D7997@users.noreply.github.com> --- launcher/ui/pages/modplatform/flame/FlameModel.cpp | 5 ++++- launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/launcher/ui/pages/modplatform/flame/FlameModel.cpp b/launcher/ui/pages/modplatform/flame/FlameModel.cpp index 56c655302..cf2bbd890 100644 --- a/launcher/ui/pages/modplatform/flame/FlameModel.cpp +++ b/launcher/ui/pages/modplatform/flame/FlameModel.cpp @@ -165,7 +165,10 @@ void ListModel::fetchMore(const QModelIndex& parent) void ListModel::performPaginatedSearch() { static const FlameAPI api; - if (m_currentSearchTerm.startsWith("#")) { + + // activate search by id only for numerical values because all CurseForge ids are numerical + static const QRegularExpression s_projectIdExpr("^\\#[0-9]+$"); + if (s_projectIdExpr.match(m_currentSearchTerm).hasMatch()) { auto projectId = m_currentSearchTerm.mid(1); if (!projectId.isEmpty()) { ResourceAPI::Callback callbacks; diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp index 9c1af44c0..5cc515536 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp @@ -135,6 +135,7 @@ void ModpackListModel::performPaginatedSearch() return; static const ModrinthAPI api; + // Modrinth ids are not limited to numbers and can be any length if (m_currentSearchTerm.startsWith("#")) { auto projectId = m_currentSearchTerm.mid(1); if (!projectId.isEmpty()) {