Trim MAL & MB id: query before lookup (#3793)

This was included for all other trackers in #3776 but these two had
prefix search before.

It's a small change, but it can go a long way when using `id:` with
copy-pasted IDs from elsewhere which come with starting or trailing
whitespace.
This commit is contained in:
MajorTanya
2026-08-17 19:43:50 +02:00
committed by GitHub
parent f75f2598a3
commit 3cc0d2c324
3 changed files with 3 additions and 2 deletions
@@ -104,7 +104,7 @@ class MangaBaka(id: Long) : BaseTracker(id, "MangaBaka"), DeletableTracker {
override suspend fun search(query: String): List<TrackSearch> {
if (query.startsWith(SEARCH_ID_PREFIX)) {
query.substringAfter(SEARCH_ID_PREFIX).toIntOrNull()?.let { id ->
query.substringAfter(SEARCH_ID_PREFIX).trim().toIntOrNull()?.let { id ->
return api.getMangaDetails(id)?.let { listOf(it) } ?: emptyList()
}
}
@@ -112,7 +112,7 @@ class MyAnimeList(id: Long) : BaseTracker(id, "MyAnimeList"), DeletableTracker {
override suspend fun search(query: String): List<TrackSearch> {
if (query.startsWith(SEARCH_ID_PREFIX)) {
query.substringAfter(SEARCH_ID_PREFIX).toIntOrNull()?.let { id ->
query.substringAfter(SEARCH_ID_PREFIX).trim().toIntOrNull()?.let { id ->
return listOf(api.getMangaDetails(id))
}
}