Activate search by project id only for numarical values for CurseForge

Signed-off-by: 0x189D7997 <199489335+0x189D7997@users.noreply.github.com>
This commit is contained in:
0x189D7997 2026-04-04 07:29:19 +00:00 committed by GitHub
parent bf75d50baf
commit 4706f894e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -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<ModPlatform::IndexedPack::Ptr> callbacks;

View file

@ -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()) {